Friday, October 28, 2016

Program Hitung ( Tambah, Kurang, Kali, Bagi ) Dengan C++

Hasil Program :

Source Code :

#include <iostream>
using namespace std;
int main(){
cout<<"Program Hitungan\n\n";
//Deklarasi Variabel//
float bil1;
float bil2;
float hasilTambah;
float hasilKurang;
float hasilBagi;
float hasilKali;
//Proses Input Bilangan//
cout<<"Masukan Bilangan Pertama = ";
cin>>bil1;
cout<<"Masukan Bilangan Kedua = ";
cin>>bil2;
//Proses Perhitungan//
hasilTambah = bil1 + bil2;
hasilKurang = bil1 - bil2;
hasilKali = bil1 * bil2;
hasilBagi = bil1 / bil2;
//Tampilkan Hasil//
cout<<"\n"<<bil1<<" + "<<bil2<<" = "<<hasilTambah<<endl<<endl;
cout<<bil1<<" - "<<bil2<<" = "<<hasilKurang<<endl<<endl;
cout<<bil1<<" * "<<bil2<<" = "<<hasilKali<<endl<<endl;
cout<<bil1<<" / "<<bil2<<" = "<<hasilBagi<<endl<<endl;
system("pause");
}

Semoga Bermanfaat :)

No comments:

Post a Comment