Warung Online

March 24, 2012

C++ ARITMATIKA


#include<iostream>

using namespace std;


int main(){

int a,b,c,d,e,f,g,h,i,j,k,l;
system("cls");
cout<<" PROGRAM PERHITUNGAN"<<endl<<endl;

cout<<" 1. PENJUMLAHAN"<<endl<<" Nilai 1 : ";
cin>>a;
cout<<" Nilai 2 : ";
cin>>b;
c=a+b;
cout<<" Hasil = "<<a<<"+"<<b<<" = "<<c<<endl;

cout<<endl<<" 2. PENGURANGAN"<<endl<<" Nilai 1 : ";
cin>>d;
cout<<" Nilai 2 : ";
cin>>e;
f=d-e;
cout<<" Hasil = "<<d<<"-"<<e<<" = "<<f<<endl;

cout<<endl<<" 3. PERKALIAN"<<endl<<" Nilai 1 : ";
cin>>g;
cout<<" Nilai 2 : ";
cin>>h;
i=g*h;
cout<<" Hasil = "<<g<<"*"<<h<<" = "<<i<<endl;

cout<<endl<<" 4. PEMBAGIAN"<<endl<<" Nilai 1 : ";
cin>>j;
cout<<" Nilai 2 : ";
cin>>k;
l=j/k;
cout<<" Hasil = "<<j<<"/"<<k<<" = "<<l<<endl;

return 0;
}