By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Converting Numbers from Indian system to International system

P: 1
I am trying to convert this program to international numerical system, its in Indian system any suggestions will help

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. void convert(long,char[]);
  5.  
  6. char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
  7. char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};
  8.  
  9.  
  10. void main()
  11. {
  12.  long n;
  13.  clrscr();
  14.  printf("Enter any 9 digit no: ");
  15.  scanf("%9ld",&n);
  16.  if(n<=0)
  17.                 printf("Enter numbers greater than 0");
  18.  else
  19.  {
  20.                   convert((n/10000000),"crore");
  21.                   convert(((n/100000)%100),"lakh");
  22.                   convert(((n/1000)%100),"thousand");
  23.                   convert(((n/100)%10),"hundred");
  24.                   convert((n%100)," ");
  25.  }
  26.  getch();
  27. }
  28.  
  29.  
  30. void convert(long n,char ch[])
  31. {
  32.  (n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
  33.  if(n)printf("%s ",ch);
  34. }
Nov 15 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.