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 is the difference between exit() and _exit() function in c?
Find MAXIMUM of three distinct integers using a single C statement
How can I change the size of the dynamically allocated array?
What are reserved words?
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What is dangling pointer in c?
How can I swap two values without using a temporary?
what are enumerations in C
What does malloc () calloc () realloc () free () do?
The file stdio.h, what does it contain?
What is the difference between malloc() and calloc()?
Differentiate fundamental data types and derived data types in C.
Explain how can I read and write comma-delimited text?
What are directives in c?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion