OR operation in C++ by R4R Team

Example-
n1=5 (i.e., 101 in binary)
n2=13 (i.e, 1101 in binary)
n1 | n2 is (101 | 1101)=1101(13 in decimal)

program:

#include< iostream>
int main() {
int a,b,n;
cout<<"Enter first number"<< endl;
cin>>a;
cout<<"Enter second number"<< endl;
cin>>b;
n=a|b;
cout<<"After OR between both number = "<< n;
}


output-

Enter first number
5
Enter second number
3
After OR between both number, 7

-In this program , we take an input of two number.
-Apply OR(|) between them and result store in variable 'n'.
-At last display that number.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!