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
What is class and object in c?
What is getch () for?
What is the difference between fread buffer() and fwrite buffer()?
Why c is called object oriented language?
Explain the difference between exit() and _exit() function?
What are loops c?
Mention four important string handling functions in c languages .
What are keywords in c with examples?
What is a char in c?
Why can't I perform arithmetic on a void* pointer?
What is an expression?
What are the 4 types of organizational structures?
What is the significance of scope resolution operator?
What is the difference between exit() and _exit() function in c?
What is difference between structure and union with example?