Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the advantages and disadvantages of a heap?

1259


What is a union?

1093


What is a substring in c?

1087


How can I ensure that integer arithmetic doesnt overflow?

1256


Is it possible to pass an entire structure to functions?

1053


When do we get logical errors?

1175


What library is sizeof in c?

1142


Why c is a procedural language?

1130


Why c is called procedure oriented language?

1109


Write a program to print factorial of given number without using recursion?

1048


What does a pointer variable always consist of?

1160


When can a far pointer be used?

1080


How is pointer initialized in c?

1094


What is the size of structure pointer in c?

1122


What is a method in c?

1212