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 language is lisp written in?
what is the structure pointer?
Is anything faster than c?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Can we access array using pointer in c language?
What is the difference between far and near in c?
Is there anything like an ifdef for typedefs?
Explain what math functions are available for integers? For floating point?
What is c standard library?
what is the significance of static storage class specifier?
How to draw the flowchart for structure programs?
What is a static function in c?
What are the key features in c programming language?
What is a pointer value and address in c?
What is the use of ?