C Program to Convert Digits into English language format Free Source Code

C Program to Convert Digits into English language format Free Source Code

Hi folks, little tight schedules this week, yesterday at night I was thinking that how can we convert Numbers in Integer digits into ENGLISH LANGUAGE format, for example, Assume you have an input 14356 so the output like be fourteen thousand three hundred fifty-six. So now, I have coded this problem in C language that’s the basis right. It’s right time to write this program here I am providing you the whole code here so you can understand logic and coding standards also.




Digits into ENGLISH LANGUAGE format ( eg. 1234 is integer represented in ENGLISH LANGUAGE is ONE THOUSAND TWO HUNDRED THIRTY-FOUR), into Roman numbers.

Here is the code in C language to Convert 9 digits number into texts.





#include<stdio.h>

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"};


int main()
{
long n;
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();
return 0;
}
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);
}





Krishna Gupta

Krishna Ballabh Gupta is a Gold Medalist Full Stack Developer & Algorithm Designer and Founder of TechnologyShouters. He generally Blogs about Python, JavaScript, jQuery, AngularJS, Database, PHP, AJAX and something that interesting.

Related Posts

Create Account



Log In Your Account



1Subscribe to Our Live Updates.