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 ...
#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 |
Write a program for deleting duplicate elements in an array
How #define works?
how to swap four numbers without using fifth variable?
diff between exptected result and requirement?
write a program to rearrange the array such way that all even elements should come first and next come odd
What is the difference between test design and test case design?
yogesh patil in dell
What is the use of void pointer and null pointer in c language?
Write a C program to read the internal test marks of 25 students in a class and show the number of students who have scored more than 50% in the test. Make necessary assumptions.
Are local variables initialized to zero by default in c?
Explain how can you avoid including a header more than once?
Where we use clrscr in c?