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


Please Help Members By Posting Answers For Below Questions

What language is lisp written in?

618


what is the structure pointer?

1644


Is anything faster than c?

587


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2008


Can we access array using pointer in c language?

645






What is the difference between far and near in c?

603


Is there anything like an ifdef for typedefs?

704


Explain what math functions are available for integers? For floating point?

615


What is c standard library?

692


what is the significance of static storage class specifier?

1665


How to draw the flowchart for structure programs?

8762


What is a static function in c?

624


What are the key features in c programming language?

617


What is a pointer value and address in c?

636


What is the use of ?

626