answersLogoWhite

0

/*mycfiles.wordpress.com
program to convert digits to character*/
#include
#include
void main()
{
int a[5],i,n;
clrscr();
cout<<"Enter the Value";
cin>>n;
for(i=4;i>=0;i--)
{
a[i]=n%10;
n=n/10;
}
for(i=0;i<5;i++)
{
if(a[i]!=0)
{
switch(a[i])
{
case 0:cout<<"Zero";
break;
case 1:cout<<"One";
break;
case 2:cout<<"Two";
break;
case 3:cout<<"Three";
break;
case 4:cout<<"Four";
break;
case 5:cout<<"Five";
break;
case 6:cout<<"Six";
break;
case 7:cout<<"Seven";
break;
case 8:cout<<"Eight";
break;
case 9:cout<<"Nine";
break;
}
}
}
getch();
}


------------------------------------------------------------------------------------


Program to Convert Numbers into Words

#include

void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};


void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}


void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}


// for any query visit
// "http://www.c.happycodings.com/Beginners_Lab_Assignments/code51.html"

Program to Convert Numbers into Words

#include

void pw(long,char[]);
char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","
eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","
fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","
seventy"," eighty"," ninety"};


void main()
{
long n;
clrscr();
printf("
Enter any 9 digit no: ");
scanf("%9ld",&n);
if(n<=0)
printf("Enter numbers greater than 0");
else
{
pw((n/10000000),"crore");
pw(((n/100000)%100),"lakh");
pw(((n/1000)%100),"thousand");
pw(((n/100)%10),"hundred");
pw((n%100)," ");
}
getch();
}


void pw(long n,char ch[])
{
(n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
if(n)printf("%s ",ch);
}


// for any query visit
// "http://www.c.happycodings.com/Beginners_Lab_Assignments/code51.html"

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Is microphones input or output device?

A Microphone does not output sound. It accepts sound. It is an input device.


What mathematical program can solve the highest number puzzle?

Any program whose output is: " Don't waste your time! There is no highest number. Never was, never will be."


What is accuracy of a good program?

It depends on to what level of accuracy you tend to have with the output of your program Accuracy can be treated as: (Desired Output / Actual Output of your Program)


Is a program with no input an incorrect program?

No, as long as it calculates something, displays something, or otherwise has an output that benefits the user, it is a program. It could be a program that makes a random number, or a program that tells the user a joke from a database.


How do you code a program to scan a number n and then output the sum of the power from 1 to n?

help me now !!


Which documentation is typically written first input output internal program or external program?

Output documentation


Design and draw a combinational circuit using AND-OR-NOT gates that accepts 4 input bits and produces two bit output the first of the two bits is set to 1 if the number of 1s in the input is even?

Design and draw a combinational circuit using AND-OR-NOT gates that accepts 4 input bits, and produces two bit output; the first of the two bits is set to 1 if the number of 1's in the input is even; and the second of the output bit is set to 1 if the input have 3 or more (all four) 1 bits.


What is input -output bound program?

input output bound program is a program (or process in precise way), which spends most of time allocated to it for execution, on input/output devices and need very small CPU time for it.


Design a combinational circuit that accepts a three bit number and generates a binary output equal to twice the input value?

There is no need for a combinatorial circuit to multiply a number by two. A binary number, left shifted one place, is twice the original binary number. The specific answer to the question is that you would connect the three input lines to the three high order output line of four output lines, and connect the low order bit of the four output lines to logic 0. If the three input lines were labelled A, B, and C, the output would be A, B, C, and 0.


What are the four steps a computer follows?

It accepts input, processes data, stores data, and produces output.


Can A Computer Output Electricity In Computercraft you can say if true output power on this side Can you say in a program to output power say to light a light So if true then output power to led's?

A Computer Output Electricity in Computercraft cannot be said to make a program to output power, regardless of the side.


How do you append a output of a program to a program?

you mean like show some sample output? Just put it in comments at the bottom. Run the program, and in the top left of the command prompt there is a button you can click. Select mark, highlight the output, then select copy. Paste it onto the end of the program.