KeyWords:GCD(greatest common divisor);formatted output;
&&;||;!
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int gcd(int a,int b){
return a%b?gcd(b,a%b):b;
}
int main()
{
int m , n;
cin>>m>>n;
cout<<"The Greatest common divisor of m and n is "<<gcd(m,n)<<endl;
return 0;
}
&&;||;!
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
bool flag1,flag2;
flag1 = true;
flag2 = true;
cout<<"Both are true :"<<(flag1&&flag2)<<endl;
flag1 = false;
flag2 = true ;
cout<<"Either is false:"<<(!(flag1&&flag2))<<endl;
flag1 = true ;
flag2 = false;
cout<<"Either is true :"<<(flag1||flag2)<<endl;
flag1 = false;
flag2 = false;
cout<<"Both are false :"<<(!flag1&&!flag2)<<endl;
}