Advertisement
amrulHarahap

Program Operator Logika

Dec 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. // Program menentukan nilai menggunakan Operator Logika
  2. // Task No.2 file 066-P03.pptx
  3. // Amrul Mubarak Harahap
  4. // 19T03 - 1901098
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main(){
  9.     int m, m2, a, b, c, d;
  10.  
  11.     cout << "Masukkan nila m pertama: ";cin >> m;
  12.     cout << "Masukkan nila m kedua: ";cin >> m2;
  13.  
  14.     a = !(m >= 0 && m2 <= 150);
  15.     b = (m >= 0 && m2 <= 150);
  16.     c = (m >= 0 || m2 <= 150);
  17.     d = !(m >= 0 || m2 <= 150);
  18.  
  19.     system ("clear");
  20.     cout << "OPERATOR LOGIKA" << endl;
  21.     cout << "==========================================="<< endl;
  22.     cout <<  m << " >= 0 && " << m2 << " <= 150 >--> " << a << endl;
  23.     cout <<  m << " >= 0 && " << m2 << " <= 150 >--> " << b << endl;
  24.     cout <<  m << " >= 0 || " << m2 << " <= 150 >--> " << c << endl;
  25.     cout <<  m << " >= 0 || " << m2 << " <= 150 >--> " << d << endl;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement