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

In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1639


Array is an lvalue or not?

648


write a program to display all prime numbers

1461


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

674


Why is c not oop?

543






write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.

1524


What is indirection?

663


write a c program for swapping two strings using pointer

2102


Why is structure important for a child?

611


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4551


Write a program to show the change in position of a cursor using c

589


Why & is used in scanf in c?

635


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1325


What is the difference between text and binary modes?

656


What is the difference between NULL and NUL?

737