#include <stdio.h>
#include <conio.h>
main ()
{
int l, p, hasil;
printf ("Masukan nilai panjang persegi panjang = "); scanf ("%d",&p);
printf ("Masukan nilai lebar persegi panjang = "); scanf ("%d",&l);
hasil = p*l;
printf ("jadi luas persegi panjang adalah = %d",hasil);
getch ();
return 0;
}
jAWABAN SOAL NO 2
#include <stdio.h>
#include <conio.h>
#define phi = 3.14
main ()
{
float jari_jari, hasil;
printf ("masukan nilai jari - jari = "); scanf ("%f",&jari_jari);
hasil =(jari_jari*jari_jari)*3.14;
printf ("Luas lingkaran = %2.2f",hasil);
getch ();
return 0;
}
jAWABAN SOAL NO 3
#include <stdio.h>
#include <conio.h>
main()
{
char no_peg [10], nama [25];
int gapok, jjl;
float besar_jjl, tunjangan, total;
printf (" Masukan Nama = "); gets (nama);
printf (" Masukan No Pegawai = "); gets (no_peg);
printf (" Masukan Gaji Pokok = Rp. "); scanf ("%d", &gapok);
printf (" Masukan Jumlah Jam Lembur = "); scanf ("%d", &jjl);
printf ("\n _______________ HASIL KERJA _________________");
printf ("\n Gaji Pokok =Rp. %d",gapok);
besar_jjl = (gapok*0.03)*jjl;
printf ("\n Jumlah Upah Lembur =Rp. %2.2f",besar_jjl);
tunjangan = (gapok*0.15);
printf ("\n Jumlah Besar Tunjangan =Rp. %2.2f",tunjangan);
total = (gapok+tunjangan+besar_jjl);
printf ("\n Total Gaji =Rp. %2.2f",total);
printf ("\n ______________ CONGRATULATION _______________");
getch ();
return 0;
}
JAWABAN SOAL NO 4
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
main()
{
int jml_uang, a, b, c, d, e, f, g, h, s_a, s_b, s_c, s_d, s_e, s_f, s_g;
printf (" Jumlah Uang : Rp."); scanf ("%d", &jml_uang);
printf ("\n ---------Hasil--------- ");
a = jml_uang / 50000;
s_a = jml_uang % 50000;
b = s_a / 20000;
s_b = s_a % 20000;
c = s_b/10000;
s_c = s_b%10000;
d=s_c/5000;
s_d=s_c%5000;
e=s_d/2000;
s_e=s_d%2000;
f=s_e/1000;
s_f=s_e%1000;
g=s_f/500;
s_g=s_f%500;
h=s_g/100;
printf (" \n Rp. 50.000 = %d Lembar ", a);
printf (" \n Rp. 20.000 = %d Lembar ", b);
printf (" \n Rp. 10.000 = %d Lembar ", c);
printf (" \n Rp. 5.000 = %d Lembar ", d);
printf (" \n Rp. 2.000 = %d Lembar ", e);
printf (" \n Rp. 1.000 = %d Lembar ", f);
printf (" \n Rp. 500 = %d Koin ", g);
printf (" \n Rp. 100 = %d Koin ", h);
getch ();
return 0;
}
Trimakasih banyak kaka
BalasHapus