write a c program to accept a given integer value and print
its value in words
Answer Posted / saurav kumar
#include<stdio.h>
int main()
{
int i,j,n;
int a[15];
printf("enter any number:");
scanf("%d",&n);
for(i=0;n>0;i++)
{
a[i]=n%10;
n=n/10;
}
for(j=i-1;j>=0;j--)
{
switch(a[j])
{
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 9:
printf("nine ");
break;
case 0:
printf("zero ");
break;
default:
printf("no number exists like this :");
}
}
}
| Is This Answer Correct ? | 30 Yes | 9 No |
Post New Answer View All Answers
What are identifiers in c?
Tell us bitwise shift operators?
What is signed and unsigned?
What is the difference between typedef and #define?
What does struct node * mean?
What is union in c?
Which one would you prefer - a macro or a function?
When was c language developed?
How do you do dynamic memory allocation in C applications?
What are the features of c language?
The file stdio.h, what does it contain?
What is a static variable in c?
How many main () function we can have in a project?
What is the symbol indicated the c-preprocessor?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.