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
What does sizeof return c?
What is output redirection?
Can you mix old-style and new-style function syntax?
Difference between pass by reference and pass by value?
Explain what are multibyte characters?
What's the right way to use errno?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
write a progrmm in c language take user interface generate table using for loop?
write a programming in c to find the sum of all elements in an array through function.
What is infinite loop?
What is the general form of #line preprocessor?
Is it possible to pass an entire structure to functions?
How do I use void main?
Explain is it valid to address one element beyond the end of an array?
What is atoi and atof in c?