#include <stdio.h>
#include <conio.h>
main ()
{
int a, b, hasil;
float x, y, hasil_fl;
printf ("\n Masukan Nilai A : "); scanf ("%d", &a);
printf ("\n Masukan Nilai B : "); scanf ("%d", &b);
printf ("hasil");
hasil = a + b;
printf ("\n %d %s %d = %d", a, "+", b, hasil);
hasil = a - b;
printf ("\n %d %s %d = %d", a, "-", b, hasil);
hasil = a * b;
printf ("\n %d %s %d = %d", a, "*", b, hasil);
hasil = a % b;
printf ("\n %d %s %d = %d", a, "%", b, hasil); printf ("(sisa hasil bagi / modulus)");
hasil = a / b;
printf ("\n %d %s %d = %d", a, "/", b, hasil); printf ("(hasil pembagian bilangan bulat)");
hasil = a / b;
x = a;
y = b;
hasil_fl = x / y;
printf ("\n %.0f / %.0f = %.2f", x, y, hasil_fl); printf (" (hasil pembagian bilangan desimal)");
getch();
return 0;
}
Tidak ada komentar:
Posting Komentar