Write a program in c to input a 5 digit number and print it
in words.
Answer Posted / rakesh.bit
# include <stdio.h>
int main ()
{
int n,temp,t,s=0,i,ctr=0;
char a[10][10] = {"zero", "one", "two", "three", "four",
"five", "six", "seven", "eight", "nine"};
printf ("Enter the number:\n");
scanf ("%d", &n);
//printf ("The given num in word = %s\n", a[n]);
t=n;
while(n>0)
{
ctr++;
n=n/10;
}
while(t>0)
{
temp=t%10;
s=10*s+temp;
t=t/10;
}
for(i=0;i<ctr;i++)
{
printf("%s",a[s%10]);
s=s/10;
}
}
Is This Answer Correct ? | 22 Yes | 16 No |
Post New Answer View All Answers
Explain what are binary trees?
How do you list files in a directory?
What are qualifiers and modifiers c?
What is atoi and atof in c?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What are Macros? What are its advantages and disadvantages?
What is the c value paradox and how is it explained?
Are global variables static in c?
What is getche() function?
What are preprocessor directives in c?
What is the difference between malloc() and calloc() function in c language?
Differentiate between Macro and ordinary definition.
What is exit() function?
Where can I get an ansi-compatible lint?
How many levels deep can include files be nested?