i m stuck at one problem...this is the program to print the given integer in words...plzz hep me to solve,,,,
Code:
#include<stdio.h>
main()
{
int num,temp1,temp2,cnt,temp3,temp4,a;
printf("Enter the number=");
scanf("%d",&num);
temp1=1;
cnt=-1;
temp3=num;
while(temp3)
{
temp2=temp3;
while(temp2)
{
temp2=temp2/10;
cnt++;
}
a=cnt;
while(a)
{
a--;
temp1=temp1*10;
}
temp4=temp3/temp1;
switch(temp4)
{
case 1:
printf("one ");
break;
case 2:
printf("two ");
break;
case 3:
printf("three ");
break;
case 4:
printf("four ");
break;
case 5:
printf("five ");
break;
case 6:
printf("six ");
break;
case 7:
printf("seven ");
break;
case 8:
printf("eight ");
break;
case 0:
printf("nine ");
break;
default:
printf("zero ");
}
temp3=temp3%temp1;
}
}