write a c program to accept a given integer value and print
its value in words

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
long int n;
int a[15];
printf("enter the number:");
scanf("%ld",&n);
for(int i=0;n>0;i++)
{
a[i]=n%10;
n=n/10;
}
for(int j=i;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 :");
}
}
getch();
}

Is This Answer Correct ?    7 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is class and object in c?

590


What is getch () for?

679


What is the difference between fread buffer() and fwrite buffer()?

674


Why c is called object oriented language?

591


Explain the difference between exit() and _exit() function?

635






What are loops c?

616


Mention four important string handling functions in c languages .

631


What are keywords in c with examples?

604


What is a char in c?

556


Why can't I perform arithmetic on a void* pointer?

639


What is an expression?

658


What are the 4 types of organizational structures?

625


What is the significance of scope resolution operator?

863


What is the difference between exit() and _exit() function in c?

584


What is difference between structure and union with example?

597