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 the main characteristics of c language describe the structure of ac program?
What are the advantages of the functions?
What is #include stdio h?
Explain how can I right-justify a string?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
What is a far pointer in c?
What are the types of type qualifiers in c?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Is c programming hard?
Can static variables be declared in a header file?
How can I find the modification date of a file?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
In a switch statement, explain what will happen if a break statement is omitted?
What does return 1 means in c?
Explain what are reserved words?