Membaca Nilai Mata Uang

#include <stdio.h>
#include <stdlib.h>
// deklarasi prosedur
void nominal(int x);
// program
int main()
{
int uang;

printf(“NAMA\t: AHMAD SANDY FEBRIAN P\n”);
printf(“NIM\t: A11.2017.10586\n”);
printf(“KELAS\t: A11.4212\n”);
puts(” “);

printf(“Masukan Jumlah Uang : “); scanf(“%d”,&uang);
nominal(uang); printf(“Rupiah\n”);
return 0;
}
// prosedur
void nominal(int x)
{
if(x==1)
{
printf(“Satu “);
}
else if(x==2)
{
printf(“Dua “);
}
else if(x==3)
{
printf(“Tiga “);
}
else if(x==4)
{
printf(“Empat “);
}
else if(x==5)
{
printf(“Lima “);
}
else if(x==6)
{
printf(“Enam “);
}
else if(x==7)
{
printf(“Tujuh “);
}
else if(x==8)
{
printf(“Delapan “);
}
else if(x==9)
{
printf(“Sembilan “);
}
else if(x==10)
{
printf(“Sepuluh “);
}
else if(x==11)
{
printf(“Sebelas “);
}
else if(x>=12&&x<=19)
{
nominal(x%10);
printf(“Belas “);
}
else if(x>=20&&x<=99)
{
nominal(x/10);
printf(“Puluh “);
nominal(x%10);
}
else if(x>=100&&x<=199)
{
printf(“Seratus “);
nominal(x-100);
}
else if(x>=200&&x<=999)
{
nominal(x/100);
printf(“Ratus “);
nominal(x%100);
}
else if(x>=1000&&x<=1999)
{
printf(“Seribu “);
nominal(x-1000);
}
else if(x>=2000&&x<=999999)
{
nominal(x/1000);
printf(“Ribu “);
nominal(x%1000);
}
else if(x>=1000000&&x<=999999999)
{
nominal(x/1000000);
printf(“Juta “);
nominal(x%1000000);
}
}

skripsi

Just another Dinus Students Blog Sites site