Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

FOCP FINAL LAB

Stud Name : KRISHNA KUMAR UID:21BCS7071


Branch: CS Section/Group:218/B
Semester: 1ST Date oF Performance:14/1/22
Subject Name: FOCP

1. Aim of the practical: WAP which implements the working of all Bitwise operators.

2. TOOL USED:

ONLINE C COMPLIER

4. CODE:
//krishna kumar 21bcs7071
// qestion :WAP which implements the working of all Bitwise operators.
#include <stdio.h>
int main()
{
unsigned char a = 10, b = 11;
int d = 0;
d = a << 1;
printf("The result of Bitwise Left Shift is %d \n", d );
d = a >> 1;
printf("The result of Bitwise Right Shift is %d \n" , d );
d = a & b;
printf("The result of Bitwise AND is %d \n", d );
d = a | b;
FOCP FINAL LAB

printf("The result of Bitwise OR is %d \n", d );


d = a ^ b;
printf("The result of Bitwise XOR is %d \n", d );
d = ~a;
printf("The result of Bitwise NOT is %d \n", d );
return 0;
}

OUTPUT:
FOCP FINAL LAB

5. EXPLANATION:

Bitwise operators are a particular type of operators in C used for bit-


level programming. It is essential to know the use of the bitwise
operator as it brings an efficient way of saving space in representing
data. Programmers use these operators in various fields, such as
systems programming, embedded programming, and designing
protocols. Hence, programmers need to know its use

6. ERROR ENCOUNTERED:
NIL
FOCP FINAL LAB

THANK YOU

You might also like