answersLogoWhite

0


Best Answer

write a c program which reads an integer value from the keyboard then it displays the number in words?

#include<stdio.h>

#include<conio.h>

void main(void)

{

int rev,n,

clrscr();

printf("\n enter any number");

scanf("%d",&n);

temp=n;

while(n>0)

{

rem=temp%10;

rev+=rem*10;

temp=temp/10;

choice=rev%10;

switch(choice)

{

case 1:

printf("one");

break;

case 2:

printf("two");

break;

case 3:

printf("three");

break;

case 4:

printf("four");

break;

case 5:

print("five");

break;

case 6:

printf("six");

break;

case 7:

printf("seven");

break:

case 8:

printf("eight");

break:

case 9:

printf("nine");

}

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include
#include
void one(int m)
{ int n;
n=m%10;
switch(n)
{ case 1:printf("One");
case 2:printf("Two");
.
.
.
case 9:........
}
}
void ten(m)
{ int a=m%10;
switch(m)
{ case 11:printf("Eleven");
........
case 15:....
}
if(m>15 && m<20)
{ one(a);
printf("teen");
}
else if(m>=20 && m<30)
{ printf("Twenty");
one(a);
}
else if(m>=30 && m<40)
{..........
}
..........
else
{ printf("Ninety");
one(a);
}
}
void hundred(int m)
{ int a=m%10,b,c;
b=a%10;
c=b%10;
one(c);
printf("Hundred");
d=b*10+a;
ten(d);
}
void main()
{ int a[3],i,n,m,c=0,r;
printf("\nEnter the no. in decimal:");
scanf("%d",&n);
m=n;c=0;
for(i=0;i<3;i++)
a[i]=0;
i=0;
do
{ r=n%10;
n%=10;
a[i]=r;
c++;
}while(n!=0);
if(c==1)
one(m);
else if(c==2)
ten(m);
else
hundred(m);
getch();
}
Just tried to give u an idea.May not be just perfect.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Use For..Next of Do..Loop function. For example,

*create a listbox named "List1".

*create a commandbutton then double click the button and copy-paste the code below.

Dim theIndex as Integer

For theIndex=0 to 299

List1.AddItem theIndex

Next

*run(f5) and click the button.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

here it is

http://www.fileden.com/files/2008/9/1/2076797/randomgen0to999.txt

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a C program to print numbers from 1 to 999 in words?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a webpage on paper?

Write it in your own words on paper or print it


Decimal numbers in words 12.9?

write the following decimal numbers in words .0087945


How do you write 1067350.00 in numbers?

write 1,067,350.00 in words


How do you write 6000 in exponents in words?

You do not write numbers in exponent for in words.


How do you print a number as on or more literal words in PHP?

Create an array like so $numbers = array(); $numbers['0'] = "ZERO"; $numbers['1'] = "ONE"; and so on.. till you decide that's enough then to print it, echo the array with the desired key like so.. Example I print 5 in words echo $numbers['5']; which would print FIVE Good luck


Do I write age in numbers or words?

Usually numbers. Unless you are young, writing it in words can be tedious!


How do write 90?

in words ninety in numbers 90


How do you write 778.5 million in numbers?

778.5 in words


How do you write 0.05 numbers in words?

It is five hundredths.


How do you write in expanded form?

You write in the numbers in words when you write in expanded.


When do you write numbers as words?

In ordinary writing, the numbers one through ten are written as words. Higher numbers are written as numbers.A sentence should not start with a numeral, so write out the number (or reword the sentence).


How do you write 5 February without words or numbers?

You cannot. If you do not have numbers, you must have words - even if they are words that only the person writing and reading can understand them.