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
What do you mean by c?
Explain what is the difference between far and near ?
Are bit fields portable?
Are negative numbers true in c?
What are the benefits of organizational structure?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Can math operations be performed on a void pointer?
Why can arithmetic operations not be performed on void pointers?
Write a program to reverse a given number in c?
What is multidimensional arrays
What functions are used in dynamic memory allocation in c?
What are the general description for loop statement and available loop types in c?
Explain what is the concatenation operator?
Is c pass by value or reference?