Program To Convert Digit To Word.

#include  stdio.h        // friend's  this blog page considering this including file as html tags so why
#include  conio.h     // I removed brackets.
void main()
{
    long n;
    int i,m;
    char *a[30]={"zero","one","two","three","four","five","six","seven","eight","nine","ten"};
    printf("Enter Your Number=");
    scanf("%ld",&n);
    for(i=0;n>0;n=n/10)
    {
        i=i*10;
        i=i+(n%10);
    }
    m=i;
    for(i=0;m>0;m=m/10)
    {
        i=i+(m%10);
        printf("%s ",a[i]);
        i=0;
    }
  
}
/* Output:--
Enter Your Number=754624984
seven five four six two four nine eight four
--------------------------------
Process exited after 8.33 seconds with return value 0
Press any key to continue . . .*/

Comments

Unknown said…
Yes.., Thanks For this Program to understand easy and reducing the line of code without switch Good...
Unknown said…
Hi,
I need reverse program like

Input: eighty six

Output: 86
Pranav Gurav said…
I will give you program soon....
Unknown said…
Not Running.. Your words to number program
Pranav Gurav said…
Muhammad Faizan,
Please Tell Me What Was Your Exact Problem.
This Code Is Running.Please Check Your Editor You are using.
It's May Be Editors Problem.
Unknown said…
There is a error in this line saying for loop ";" is not present
for(i=0;i<10 br="" i=""> {
for(j=0;j<9 br="" j=""> {
when i put ";" in between the br="" & i<10 it is saying can't convert char to int. and also br is not declared in the main

Popular posts from this blog

Program To Convert Number In Word To Digit In C Language

Program To Convert Upto 9 Digit Number To Words