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
Write a code of a general series where the next element is the sum of last k terms.
how is the examination pattern?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
What is typedf?
What is scope rule in c?
What is the use of a static variable in c?
Hai what is the different types of versions and their differences
What is a char in c?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is the value of uninitialized variable in c?
State two uses of pointers in C?
What are c identifiers?
How is a pointer variable declared?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none