OR bitwise operator 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< stdio.h>
int main() {
int a,b,n;
printf("Enter first number\n");
scanf("%d",&a);
printf("Enter second number\n");
scanf("%d",&b);
n=a|b;
printf("After OR between both number = %d",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!