write a c code "if you give a any decimal number then print that number in english alphabet"?
ex: i/p: 552
o/p: five hundred fifty two ...
Answer Posted / baluusa8
#include<stdio.h>
void main()
{
int number,i=0,j,digit;
char * word[1000];
printf("Enter number
");
scanf("%d",&number);
while(number){
digit = number %10;
number = number /10;
switch(digit){
case 0: word[i++] = "zero"; break;
case 1: word[i++] = "one"; break;
case 2: word[i++] = "two"; break;
case 3: word[i++] = "three"; break;
case 4: word[i++] = "four"; break;
case 5: word[i++] = "five"; break;
case 6: word[i++] = "six"; break;
case 7: word[i++] = "seven"; break;
case 8: word[i++] = "eight"; break;
case 9: word[i++] = "nine"; break;
}
}
for(j=i-1;j>=0;j--){
printf("%s ",word[j]);
}
}
| Is This Answer Correct ? | 1 Yes | 5 No |
Post New Answer View All Answers
Do you know the use of 'auto' keyword?
Is c still used?
what is the diffrenet bettwen HTTP and internet protocol
Can you please explain the difference between malloc() and calloc() function?
can we change the default calling convention in c if yes than how.........?
Which header file is used for clrscr?
Is a house a shell structure?
Is the exit() function same as the return statement? Explain.
What are the 5 organizational structures?
What is a pointer on a pointer in c programming language?
How can I make it pause before closing the program output window?
Write a program to reverse a string.
What is %d used for?
What is the function of volatile in c language?
Write a program in c to replace any vowel in a string with z?