0% found this document useful (0 votes)
35 views2 pages

Kal Kula Tor

The document contains code for a C program that allows a user to select an arithmetic operator, then prompts the user to input values and displays the result. The program supports addition, subtraction, multiplication, division, and exponentiation. It uses scanf to input values, switch case statements to select the operator, and printf to output the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Kal Kula Tor

The document contains code for a C program that allows a user to select an arithmetic operator, then prompts the user to input values and displays the result. The program supports addition, subtraction, multiplication, division, and exponentiation. It uses scanf to input values, switch case statements to select the operator, and printf to output the result.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <stdio.

h>
#include <conio.h>
#include <math.h>

int x,y,hasil,pilihan;
float a,b,hasilpangkat;
void main ()
{
printf("\n PILIH OPERATOR :");
printf("\n 1. penjumlahan");
printf("\n 2. pengurangan");
printf("\n 3. perkalian");
printf("\n 4. pembagian");
printf("\n 5. perpangkatan");

printf("\n PILIH : ");


scanf("%d",&pilihan);

switch (pilihan)
{
case 1:
printf("\n input x : ");
scanf("%d", &x);
printf("\n input y : ");
scanf("%d", &y);
hasil=x+y;
printf("\n hasil = %d", hasil);
break;

case 2:
printf("\n input x : ");
scanf("%d", &x);
printf("\n input y : ");
scanf("%d", &y);
hasil=x-y;
printf("\n hasil = %d", hasil);
break;

case 3:
printf("\n input x : ");
scanf("%d", &x);
printf("\n input y : ");
scanf("%d", &y);
hasil=x*y;
printf("\n hasil = %d", hasil);
break;

case 4:
printf("\n input x : ");
scanf("%d", &x);
printf("\n input y : ");
scanf("%d", &y);
hasil=x/y;
printf("\n hasil = %d", hasil);
break;

case 5:
printf("\n input a : ");
scanf("%f", &a);
printf("\n input b : ");
scanf("%f", &b);
hasilpangkat= pow(a,b);
printf("\n hasil = %.1f",hasilpangkat);
break;
}
getch();
}

You might also like