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 |
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
write a program using virtual function to find the transposing of a square matrix?
Perform the functionality of 2-D array through 1-D array and in it the functions to be performed were: (1) Display the array in 2-D format (2) Display a particular element (3) Display a particular row (4) Display a particular column
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
1. Write a program that performs the following. The user inputs a number and then enters a series of numbers from 1 to that number. Your program should determine which number (or numbers) is missing or duplicated in the series, if any. For example, if the user entered 5 as the initial number and then entered the following sequences, the results should be as shown. Input Sequence Output ---------------------- --------------- 1 2 3 4 5 Nothing bad However, if 7 were the high number, the user would see the results on the right for the following number entries: Input Sequence Output ---------------------- --------------- 1 3 2 4 5 Missing 6 Missing 7 And if 10 were the high number and the user entered the numbers shown on the left, note the list of missing and duplicate numbers: Input Sequence Output ---------------------- --------------- 1 2 4 7 4 4 5 10 8 2 6 Duplicate 2 ( 2 times) Missing 3 Duplicate 4 ( 3 times ) Missing 9
Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
A research student is given a singly-linked list. Each node of the list has a color, which is either “Black” or “White”. He must find if there are more black nodes than white nodes, or vice versa. His advisor gives him 5,000Rs to buy a computer to do the work. He goes to the computer store and finds a slightly defective computer which costs a mere 3,000Rs. This computer has the small problem of not being able to do arithmetic. This means that he cannot use a counter to count the nodes in the list to determine the majority color. The computer is otherwise fully functional. He has the evil idea that he could buy the defective computer and somehow use it to do his work, so that he can use the rest of the money on enjoyment. Show how he can accomplish this amazing task. Write code for an algorithm called ‘findMajorityColor’ which takes a singly-linked list, L, with n nodes and returns the majority color among nodes of L. This algorithm should have the same asymptotic running time as counting the nodes (O(n)). Note: No arithmetic is allowed.
Write a simple encryption program using string function which apply the substitution method.
write a c program, using for loop, that accepts and odds two numbers. The output must be the sum and the addens. This should be repeated 5 times while the first number is decremented by one and the second number is incremented by 1.
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
0 Answers Jomo Kenyatta University,
Code for Easily Using Hash Table?
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.