Pages

Spell Number Program in C


This program will spell our input number with the maximum number is 999.999.999. This spelling method uses bahasa Indonesia but It doesn’t have many differences with English.


#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

char a[];
char temp[];
int i;

void tulis (char c)
{
  switch (c)
  {


    case '1':
    printf ("satu ");
    break;
    case '2':
    printf ("dua ");
    break;
    case '3':
    printf ("tiga ");
    break;
    case '4':
    printf ("empat ");
    break;
    case '5':
    printf ("lima ");
    break;
    case '6':
    printf ("enam ");
    break;
    case '7':
    printf ("tujuh ");
    break;
    case '8':
    printf ("delapan ");
    break;
    case '9':
    printf ("sembilan ");
    break;
  }
}

void tukar (int d)
{
  for (i=0;i=0;i--)
  {
    if (i==6 || i==3 || i==0)
    {
      if (temp[i]=='0' && b==1)
      {printf ("nol ");}
      else if (temp[i]=='1' && b==4)
      {printf ("se");}
      else
      {
        if (temp[i+1]!='1')
        {tulis(temp[i]);}
      }
    }
    else if (i==7 || i==4 || i==1)
    {
      if (temp[i]=='1' && temp[i-1]=='0')
      {
        printf("sepuluh ");
      }
      else if (temp[i]=='1' && temp[i-1]=='1')
      {
        printf("sebelas ");
      }
      else
      {
        if (temp[i]=='1')
        {tulis(temp[i-1]);
        printf("belas ");}
        else if (temp[i]!='0' && temp[i]!='1')
        {tulis(temp[i]);
        printf("puluh ");}
      }
    }
    else if (i==8 || i==5 || i==2)
    {
      if(temp[i]=='1')
      {printf("seratus ");}
      else if (temp[i]!='0' && temp[i]!='1')
      {tulis(temp[i]);
      printf("ratus ");}
    }

  if (i==6)
  {
    printf("juta ");
  }
  else if (i==3)
  {
    printf("ribu ");
  }

}

return 0;
}

Download Spell Number Program (tes.exe) (run in Command Prompt)


1 comment:

  1. Shifting from one place to another is not an easy task and it could be increase when we hired wrong service provider. SO, If you are looking for packers and movers in jamnagar, then visit to Dealkare for reliable service providers.

    ReplyDelete