Jumat, 02 September 2016

Operator Relasi Logika Pada C++


#include<iostream.h>
using namespace std;

int main()
{
int a, b, c;

//inisialisasi variabel
a = 2;
b = 8;

int j, k, l , m;
j = a>b;
k = a<b;
l = a==b;
m = a!=b;


cout<<" \n Diketahui : \n";
cout<<" a > b : "<<j<<endl;
cout<<" a < b : "<<k<<endl;
cout<<" a == b : "<<l<<endl;
cout<<" a != b : "<<m<<endl;

c= a == b;
cout<<" c : "<<c<<endl;
cout<<" !c : "<<!c<<endl;

}


Output :


0 komentar:

Posting Komentar