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


Please Help Members By Posting Answers For Below Questions

What is the difference between text and binary i/o?

667


What is the process to generate random numbers in c programming language?

722


What will the preprocessor do for a program?

661


What are the keywords in c?

746


List the variables are used for writing doubly linked list program.

1707






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.

1579


What is variables in c?

693


What are the restrictions of a modulus operator?

730


Explain why C language is procedural?

860


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

779


What is meant by inheritance?

725


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

674


Using which language Test cases are added in .ptu file of RTRT unit testing???

3796


write a program to rearrange the array such way that all even elements should come first and next come odd

1871


How do I swap bytes?

723