write a c program to accept a given integer value and print
its value in words
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
long int n;
int a[15];
printf("enter the number:");
scanf("%ld",&n);
for(int i=0;n>0;i++)
{
a[i]=n%10;
n=n/10;
}
for(int j=i;j>0;j--)
{
switch(a[j])
{
case 1:
printf("one ");
break;
case 2:
printf("two ");
break;
case 3:
printf("three ");
break;
case 4:
printf("four ");
break;
case 5:
printf("five ");
break;
case 6:
printf("six ");
break;
case 7:
printf("seven ");
break;
case 8:
printf("eight ");
break;
case 9:
printf("nine ");
break;
case 0:
printf("zero ");
break;
default:
printf("no number exists like this :");
}
}
getch();
}
Is This Answer Correct ? | 7 Yes | 29 No |
Post New Answer View All Answers
What is the difference between text and binary i/o?
What is the process to generate random numbers in c programming language?
What will the preprocessor do for a program?
What are the keywords in c?
List the variables are used for writing doubly linked list program.
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
What is variables in c?
What are the restrictions of a modulus operator?
Explain why C language is procedural?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
What is meant by inheritance?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Using which language Test cases are added in .ptu file of RTRT unit testing???
write a program to rearrange the array such way that all even elements should come first and next come odd
How do I swap bytes?