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 ...



write a c code "if you give a any decimal number then print that number in english alphabet&quo..

Answer / 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

More C Interview Questions

Write a program for deleting duplicate elements in an array

3 Answers   Subex,


How #define works?

0 Answers  


how to swap four numbers without using fifth variable?

2 Answers  


diff between exptected result and requirement?

0 Answers   HCL,


write a program to rearrange the array such way that all even elements should come first and next come odd

0 Answers  






What is the difference between test design and test case design?

0 Answers  


yogesh patil in dell

3 Answers   DELL,


What is the use of void pointer and null pointer in c language?

0 Answers  


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.

1 Answers  


Are local variables initialized to zero by default in c?

0 Answers  


Explain how can you avoid including a header more than once?

0 Answers  


Where we use clrscr in c?

0 Answers  


Categories