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 is the most efficient way to count the number of bits which are set in an integer?
What should malloc(0) do?
Is c compiled or interpreted?
What do you mean by Recursion Function?
What are the modifiers available in c programming language?
Can a variable be both static and volatile in c?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What is pointer to pointer in c?
Write a program to reverse a string.
What is the usage of the pointer in c?
Define Spanning-Tree Protocol (STP)
What is static identifier?
Which built-in library function can be used to match a patter from the string?
How #define works?
What is the use of pragma in embedded c?