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 c &c++?
What is the difference between if else and switchstatement
What is omp_num_threads?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
Multiply an Integer Number by 2 Without Using Multiplication Operator
List the difference between a "copy constructor" and a "assignment operator"?
Was 2000 a leap year?
What are the types of bitwise operator?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
how to introdu5ce my self in serco
What is meant by inheritance?
What’s the special use of UNIONS?
i want to know the procedure of qualcomm for getting a job through offcampus
What are the advantages of the functions?
What is pointer and structure in c?