RSS

Operan

#include <stdio.h>
#include <math.h>

void main()

{

int a,b,c;
double hasil;
cobalagi:

printf(“Menu Calculator : \n\n”);
printf(“\t 1. Penambahan \n”);
printf(“\t 2. Pengurangan \n”);
printf(“\t 3. Perkalian \n”);
printf(“\t 4. Pembagian \n”);
printf(“\t 5. Pangkat \n\n”);
printf(“Masukkan Pilihan Anda : “);
scanf(“%d”,&a);
printf(“Masukkan Operan : “);
scanf(“%d %d”,&b,&c);

if(a==1){
hasil=b+c;
printf(“Hasilnya : %0.0lf \n\n”,hasil);
}else if(a==2){
hasil=b-c;
printf(“Hasilnya : %0.0lf \n\n”,hasil);
}else if(a==3){
hasil=b*c;
printf(“Hasilnya : %0.0lf \n\n”,hasil);
}else if(a==4){
hasil=b/c;
printf(“Hasilnya : %0.0lf \n\n”,hasil);
}else if(a==5){
hasil=pow(a,b);
printf(“Hasilnya : %0.2lf \n\n”,hasil);
}else
printf(“Fatal Eror!!!!!\n\n”);

goto cobalagi;
}

 

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

 
%d blogger menyukai ini: