write a program that accepts a number and outputs its
equivalent in words.
take note that the maximum input is 3000
Buddy it will accept any no. less than 1crore
prog in C
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<process.h>
int main()
{
int l=0;
char n[6],i ;
clrscr();
printf("enter number");
scanf("%s",n);
l=strlen(n);
if(l==1)
{
switch(n[0])
{
case '0':
printf("zero");
getch();
exit(0);
case '1':
printf("one");
getch();
exit(0);
case '2':
printf("two");
getch();
exit(0);
case '3':
printf("three");
getch();
exit(0);
case '4':
printf("four");
getch();
exit(0);
case '5':
printf("five");
getch();
exit(0);
case '6':
printf("six");
getch();
exit(0);
case '7':
printf("seven");
getch();
exit(0);
case '8':
printf("eight");
getch();
exit(0);
case '9':
printf("nine");
getch();
exit(0);
}}
if(l==2)
{
switch(n[0])
{case '1':
switch(n[1])
{
case '0':
printf("ten");
getch();
exit(0);
case '1':
printf("eleven");
getch();
exit(0);
case '2':
printf("twelve");
getch();
exit(0);
case '3':
printf("thirteen");
getch();
exit(0);
case '4':
printf("fourteen");
getch();
exit(0);
case '5':
printf("fifteen");
getch();
exit(0);
case '6':
printf("sixteen");
getch();
exit(0);
case '7':
printf("seventeen");
getch();
exit(0);
case '8':
printf("eighteen");
getch();
exit(0);
case '9':
printf("ninteen");
getch();
exit(0);
}
case'2': printf("twenty\t");
break;
case'3': printf("thirty\t");
break;
case'4': printf("fourty\t");
break;
case'5': printf("fifty\t");
break;
case'6': printf("sixty\t");
break;
case'7': printf("seventy\t");
break;
case'8': printf("eighty\t");
break;
case '9':printf("ninty\t");
break;
}
switch(n[1])
{
case '1':
printf("one");
getch();
exit(0);
case '2':
printf("two");
getch();
exit(0);
case '3':
printf("three");
getch();
exit(0);
case '4':
printf("four");
getch();
exit(0);
case '5':
printf("five");
getch();
exit(0);
case '6':
printf("six");
getch();
exit(0);
case '7':
printf("seven");
getch();
exit(0);
case '8':
printf("eight");
getch();
exit(0);
case '9':
printf("nine");
getch();
exit(0);
}}
if(l==3){
switch(n[0])
{
case'1':printf("one hundred and");
break;
case'2': printf("two hundred and");
break;
case'3': printf("three hundred and");
break;
case'4': printf("four hundred and");
break;
case'5': printf("five hundred and");
break;
case'6': printf("six hundred and");
break;
case'7': printf("seven hundred and");
break;
case'8': printf("eight hundred and");
break;
case '9':printf("ninte hundred and");
break;
}
switch(n[1])
{
case'0':
break;
case '1':
switch(n[2])
{
case '0':
printf("ten");
getch();
exit(0);
case '1':
printf("eleven");
getch();
exit(0);
case '2':
printf("twelve");
getch();
exit(0);
case '3':
printf("thirteen");
getch();
exit(0);
case '4':
printf("fourteen");
getch();
exit(0);
case '5':
printf("fifteen");
getch();
exit(0);
case '6':
printf("sixteen");
getch();
exit(0);
case '7':
printf("seventeen");
getch();
exit(0);
case '8':
printf("eighteen");
getch();
exit(0);
case '9':
printf("ninteen");
getch();
exit(0); }
case'2': printf(" twenty");
break;
case'3': printf(" thirty");
break;
case'4': printf(" fourty");
break;
case'5': printf(" fifty");
break;
case'6': printf(" sixty");
break;
case'7': printf(" seventy");
break;
case'8': printf(" eighty");
break;
case '9':printf(" ninty");
break;
}
switch(n[2])
{
case '1':
printf("one");
getch();
exit(0);
case '2':
printf("two");
getch();
exit(0);
case '3':
printf("three");
getch();
exit(0);
case '4':
printf("four");
getch();
exit(0);
case '5':
printf("five");
getch();
exit(0);
case '6':
printf("six");
getch();
exit(0);
case '7':
printf("seven");
getch();
exit(0);
case '8':
printf("eight");
getch();
exit(0);
case '9':
printf("nine");
getch();
exit(0);
}
}
if(l==4)
{
switch(n[0])
{
case '1':
printf("one thousand");
break;
case '2':
printf("two thousand");
break;
case '3':
printf("three thousand");
break;
case '4':
printf("four thousand");
break;
case '5':
printf("five thousand");
break;
case '6':
printf("six thousand");
break;
case '7':
printf("seven thousand");
break;
case '8':
printf("eight thousand");
break;
case '9':
printf("nine thousand");
break;
}
switch(n[1])
{case '0';
case'1':printf(" one hundred and");
break;
case'2': printf(" two hundred and");
break;
case'3': printf(" three hundred and");
break;
case'4': printf(" four hundred and");
break;
case'5': printf(" five hundred and");
break;
case'6': printf(" six hundred and");
break;
case'7': printf(" seven hundred and");
break;
case'8': printf(" eight hundred and");
break;
case '9':printf(" ninte hundred and");
break;
}
switch(n[2])
{
case'0':
break;
case '1':
switch(n[3])
{
case '0':
printf("ten");
getch();
exit(0);
case '1':
printf("eleven");
getch();
exit(0);
case '2':
printf("twelve");
getch();
exit(0);
case '3':
printf("thirteen");
getch();
exit(0);
case '4':
printf("fourteen");
getch();
exit(0);
case '5':
printf("fifteen");
getch();
exit(0);
case '6':
printf("sixteen");
getch();
exit(0);
case '7':
printf("seventeen");
getch();
exit(0);
case '8':
printf("eighteen");
getch();
exit(0);
case '9':
printf("ninteen");
getch();
exit(0); }
case'2': printf(" twenty");
break;
case'3': printf(" thirty");
break;
case'4': printf(" fourty");
break;
case'5': printf(" fifty");
break;
case'6': printf(" sixty");
break;
case'7': printf(" seventy");
break;
case'8': printf(" eighty");
break;
case '9':printf(" ninty");
break;
}
switch(n[3])
{ case '0':
break;
case '1':
printf("one");
getch();
exit(0);
case '2':
printf("two");
getch();
exit(0);
case '3':
printf("three");
getch();
exit(0);
case '4':
printf("four");
getch();
exit(0);
case '5':
printf("five");
getch();
exit(0);
case '6':
printf("six");
getch();
exit(0);
case '7':
printf("seven");
getch();
exit(0);
case '8':
printf("eight");
getch();
exit(0);
case '9':
printf("nine");
getch();
exit(0);
}
}
getch();
return 0;
}
Is This Answer Correct ? | 11 Yes | 27 No |
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.
write a program that can locate elements in array.
Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?
0 Answers ASD Lab, Qatar University, UNV,
void main() { int i,j=2; for(i=0;i<3;i++) if(j=i) cout<<"Lotus "; else cout<<"Rose "; } Its result is Rose Lotus Lotus.. How? Explain it?
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }
How to swap two ASCII numbers?
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.
output for printf("printf");
i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.