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
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
What are the advantages of external class?
Explain what are the different file extensions involved when programming in c?
Why string is used in c?
the question is that what you have been doing all these periods (one year gap)
why return type of main is not necessary in linux
What is the g value paradox?
How to write a multi-statement macro?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What is the advantage of c?
What are bitwise shift operators in c programming?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What is the default value of local and global variables in c?