Advertisement
Guest User

aritmatika.cxx

a guest
Jul 17th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     float a = 9;
  8.     int b = 7;
  9.     float hasil;
  10.     cout << "\noperasi aritmatika\n";
  11.     //penjumlahan
  12.     hasil = a + b;
  13.  
  14.     cout << a << "+" << b << "=" << hasil << endl;
  15.  
  16.     //pengurangan
  17.     hasil = a - b;
  18.  
  19.     cout << a << "-" << b << "=" << hasil << endl;
  20.  
  21.     //perkalian
  22.     hasil = a * b;
  23.  
  24.     cout << a << "*" << b << "=" << hasil << endl;
  25.     //pembagian
  26.     hasil = a / b;
  27.  
  28.     cout << a << "/" << b << "=" << hasil << endl;
  29.     //modulus
  30.  
  31.     //hasil=a%b;
  32.  
  33.     //cout<<a<<"%"<<b<<"="<<hasil<<endl;
  34.  
  35.     hasil = (a + b) * a;
  36.     cout << hasil << endl;
  37.     cin.get();
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement