assalamualaikum sobat ,, ketemu dengan aku lagi , nih aku bagi program sederhana menggunakan bahasa "C", yang mau copas atau mau nambahin silahkan !!!
#include<conio.h>
#include<stdio.h>
int
main()
{
int luas,pjg,lbr,als,tng,pil,sisi,a,b,c,user,pas;
char sgt,pp,psg,lng,lagi,lagi1;
login:
printf ("Silahkan masuk Dulu !!!\n");
printf ("User : ");
scanf ("%i",&user);
printf ("Password : ");
scanf ("%i",&pas);
if (user==123 && pas==123)
{
clrscr();
goto awal;
}
else
{
clrscr();
goto login;
}
awal:
printf ("==========PERHITUNGAN BANGUN DATAR==========\n");
printf ("1. Segitiga\n");
printf ("2. Persegi Panjang\n");
printf ("3. Persegi\n");
printf ("4. Lingkaran\n");
printf ("Silahkan pilih bangun datar (1/2/3/4): ");
scanf ("%i",&pil);
if (pil==1)
{
printf ("Anda memilih Segitiga\n");
goto segitigax;
}
else if (pil==2)
{
printf ("Anda memilih Persegi Panjang\n");
goto perpx;
}
else if (pil==3)
{
printf ("Anda memilih Persegi\n");
goto persegix;
}
else if (pil==4)
{
printf ("Anda memilih Lingkaran\n");
}
else
{
printf ("kode salah !!");
}
segitigax:
printf ("tampilkan rumus (y/n): ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto segitiga;
}
else
{
clrscr();
goto awal;
}
perpx:
printf ("tampilkan rumus (y/n): ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto perp;
}
else
{
clrscr();
goto awal;
}
persegix:
printf ("tampilkan rumus (y/n): ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto persegi;
}
else
{
clrscr();
goto awal;
}
segitiga:
printf ("L = 1/2.a.t\n");
printf ("K = A+B+C\n");
printf ("coba contoh soal !!(y/n)");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto contoh1;
}
else
{
clrscr();
goto awal;
}
contoh1:
printf ("LUAS\n");
printf ("Masukkan Alas : ");
scanf ("%i",&als);
printf ("Masukkan Tinggi : ");
scanf ("%i",&tng);
printf ("<<Jawab>>\n");
printf (" L = 1/2.a.t\n");
printf (" L = 1/2.");
printf ("%i",als);
printf (".");
printf ("%i\n",tng);
printf (" L = %i\n",(als*tng)/2);
printf ("KELILING\n");
printf ("Masukkan sisi A : ");
scanf ("%i",&a);
printf ("Masukkan sisi B : ");
scanf ("%i",&b);
printf ("Masukkan sisi C : ");
scanf ("%i",&c);
printf ("<<Jawab>>\n");
printf (" K = a + b + c\n");
printf (" K = ");
printf ("%i",a);
printf (" + ");
printf ("%i",b);
printf (" + ");
printf ("%i\n",c);
printf (" K = %i\n",a+b+c);
printf ("kembali ke menu utama (y/n) : ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
clrscr();
goto awal;
}
else
{
}
perp:
printf ("L = P.l\n");
printf ("K = 2(P+l)\n");
printf ("coba contoh soal !!(y/n)");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto contoh2;
}
else
{
clrscr();
goto awal;
}
contoh2:
printf ("LUAS\n");
printf ("Masukkan Panjang : ");
scanf ("%i",&pjg);
printf ("Masukkan Lebar : ");
scanf ("%i",&lbr);
printf ("<<Jawab>>\n");
printf (" L = P . l\n");
printf (" L = %i",pjg);
printf (" . ");
printf ("%i\n",lbr);
printf (" L = %i\n",pjg*lbr);
printf ("KELILING\n");
printf ("<<Jawab>>\n");
printf (" K = 2(P + l)\n");
printf (" K = 2(");
printf ("%i",pjg);
printf (" + ");
printf ("%i",lbr);
printf (")\n");
printf (" K = %i\n",2*(pjg+lbr));
printf ("kembali ke menu utama (y/n) : ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
clrscr();
goto awal;
}
else
{
}
persegi:
printf ("L = S.S\n");
printf ("K = 4.S\n");
printf ("coba contoh soal !!(y/n)");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
goto contoh3;
}
else
{
clrscr();
goto awal;
}
contoh3:
printf ("LUAS\n");
printf ("Masukkan Sisi : ");
scanf ("%i",&sisi);
printf ("<<Jawab>>\n");
printf (" L = S . S\n");
printf (" L = %i",sisi);
printf (" . ");
printf ("%i\n",sisi);
printf (" L = %i\n",sisi*sisi);
printf ("KELILING\n");
printf ("<<Jawab>>\n");
printf (" K = 4.S\n");
printf (" K = 4.");
printf ("%i",sisi);
printf (" K = %i\n",4*sisi);
printf ("kembali ke menu utama (y/n) : ");
scanf ("%s",&lagi);
if (lagi=='y' || lagi=='Y' )
{
clrscr();
goto awal;
}
else
{
}
getch ();
return 0;
}
No comments:
Post a Comment