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

In CMM or CMMI certified organizations,we assess only the standard software processes of the organization. We do not assess the organizations other functional departments like HR or Admin. Then how can we certify the entire organization as CMM level company?? We have assessed only software related activities. Right. There is no relation with other departments like Accounts, HR or Admin. Then how can we claim that the whole company is a CMM certified company?

1 Answers   Melstar,


to convert a string without using decrement operater and string functions

1 Answers  


How can I do peek and poke in c?

0 Answers  


Describe advantages and disadvantages of the various stock sorting algorithms

1 Answers   Microsoft,


Explain how can I make sure that my program is the only one accessing a file?

0 Answers  






program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.

3 Answers  


what is the output of the following program? #include<stdio.h> void main() { float x=1.1; while(x==1.1) { printf("\n%f",x); x=x-0.1; } }

6 Answers  


What is a buffer in c?

0 Answers  


What is conio h in c?

0 Answers  


WHAT IS HIGH LEVEL LANGUAGE?

2 Answers  


What is the difference between char a[] = "string"; and char *p = "string"; ?

14 Answers   Adobe, Honeywell, TCS,


WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES

1 Answers  


Categories