Program ini dibuat dengan 4 fungsi yaitu :
- Perkalian
- Pembagian
- Pengurangan
- Penambahan
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
int input1,input2, kali, bagi, tambah, kurang;
cout<<"Input angka 1 :";
cin>>input1;
cout<<"Input angka 2 :";
cin>>input2;
cout<<endl;
kali=input1*input2;
cout<<"Hasil Perkalian :"<<input1<<" x "<<input2<<" = "<<kali<<endl;
bagi=input1/input2;
cout<<"Hasil Pembagian :"<<input1<<" / "<<input2<<" = "<<bagi<<endl;
tambah=input1+input2;
cout<<"Hasil Tambah :"<<input1<<" + "<<input2<<" = "<<tambah<<endl;
kurang=input1-input2;
cout<<"Hasil Kurang :"<<input1<<" - "<<input2<<" = "<<kurang<<endl;
return 0;
}
using namespace std;
int main(int argc, char** argv) {
int input1,input2, kali, bagi, tambah, kurang;
cout<<"Input angka 1 :";
cin>>input1;
cout<<"Input angka 2 :";
cin>>input2;
cout<<endl;
kali=input1*input2;
cout<<"Hasil Perkalian :"<<input1<<" x "<<input2<<" = "<<kali<<endl;
bagi=input1/input2;
cout<<"Hasil Pembagian :"<<input1<<" / "<<input2<<" = "<<bagi<<endl;
tambah=input1+input2;
cout<<"Hasil Tambah :"<<input1<<" + "<<input2<<" = "<<tambah<<endl;
kurang=input1-input2;
cout<<"Hasil Kurang :"<<input1<<" - "<<input2<<" = "<<kurang<<endl;
return 0;
}
Hasil Run :
0 Response to "Program Kalkulator Sederhana C++"
Posting Komentar