#include "stdio.h"
int a,b,c,pil;
void tambah();
void kurang();
void kali();
void bagi();
void main()
{
clrscr();
printf("======Menu=====");
printf("\n1. Pertambahan");
printf("\n2. Pengurangan");
printf("\n3. Perkalian");
printf("\n4. Pembagian");
printf("\n5. Exit\n");
printf("Masukkan pilihan anda : ");
scanf("%d",&pil);
switch(pil) {
case 1 : tambah();
case 2 : kurang();
case 3 : kali();
case 4 : bagi();
case 5 : exit(0);
default : printf("Input Salah\nMasukkan nilai dari 1-5");
getch();
main();
}
}
void tambah () {
int a,b,c;
printf("\nNilai Pertama : "); scanf("%d",&a);
printf("\nNilai Kedua : "); scanf("%d",&b);
c=a+b;
printf("\n%d + %d = %d",a,b,c);
getch();
main();
}
void kurang () {
int a,b,c;
printf("\nNilai Pertama : "); scanf("%d",&a);
printf("\nNilai Kedua : "); scanf("%d",&b);
c=a-b;
printf("\n%d - %d = %d",a,b,c);
getch();
main();
}
void kali () {
int a,b,c;
printf("\nNilai Pertama : "); scanf("%d",&a);
printf("\nNilai Kedua : "); scanf("%d",&b);
c=a*b;
printf("\n%d x %d = %d",a,b,c);
getch();
main();
}
void bagi () {
int a,b,c;
printf("\nNilai Pertama : "); scanf("%d",&a);
printf("\nNilai Kedua : "); scanf("%d",&b);
c=a/b;
printf("\n%d : %d = %d",a,b,c);
getch();
main();
}
Listing LA AP3 ke-7
Diposkan oleh
한효리
Friday, November 19, 2010
Label: kampus
0 komentar:
Post a Comment