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

What is the concatenation operator?

0 Answers  


What is getche() function?

0 Answers  


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

0 Answers  


What is meant by initialization and how we initialize a variable?

0 Answers  


Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 1) 10 2) 11 3) 1

6 Answers  






Explain what is the difference between #include and #include 'file' ?

0 Answers  


Explain what is gets() function?

0 Answers  


What is the acronym for ansi?

0 Answers  


Who developed c language and when?

0 Answers  


What are 'near' and 'far' pointers?

0 Answers  


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

0 Answers  


What is an array? What the different types of arrays in c?

0 Answers  


Categories