0% found this document useful (0 votes)
44 views3 pages

Ex. No. Bit Wise Operator : 18Cs1002 Programming For Problem Solving Lab

This document contains a C program that demonstrates various bitwise operators: and, or, xor, not, and shifting. The program defines integers a and b, performs bitwise operations on them, and prints the results. It aims to write a program using bitwise operators like and, or, not, shifting to understand how they work at the bit level. The program is run and the output verifies that the bitwise operators are working as expected.

Uploaded by

celshia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views3 pages

Ex. No. Bit Wise Operator : 18Cs1002 Programming For Problem Solving Lab

This document contains a C program that demonstrates various bitwise operators: and, or, xor, not, and shifting. The program defines integers a and b, performs bitwise operations on them, and prints the results. It aims to write a program using bitwise operators like and, or, not, shifting to understand how they work at the bit level. The program is run and the output verifies that the bitwise operators are working as expected.

Uploaded by

celshia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

18CS1002 PROGRAMMING FOR PROBLEM SOLVING LAB <REG. No.

>

Ex. No.
Bit wise operator <Title>
<Date of Exercise>

Aim
<Aim here>

To write a c program for bitwise operator and , or,not, Xor and shifting

Algorithm

<Algorithm here>

Flowchart
start

Get the input of a


and b

a &b

Calculate C=a&b

Program
<Program here> stop
#include <stdio.h>

main() {

Ex. No. | < Ex. Title>


18CS1002 PROGRAMMING FOR PROBLEM SOLVING LAB <REG. No.>

int a = 60; /* 60 = 0011 1100 */

int b = 13; /* 13 = 0000 1101 */

int c = 0;

c = a & b; /* 12 = 0000 1100 */

printf("Line 1 - Value of c is %d\n", c );

c = a | b; /* 61 = 0011 1101 */

printf("Line 2 - Value of c is %d\n", c );

c = a ^ b; /* 49 = 0011 0001 */

printf("Line 3 - Value of c is %d\n", c );

c = ~a; /*-61 = 1100 0011 */

printf("Line 4 - Value of c is %d\n", c );

c = a << 2; /* 240 = 1111 0000 */

printf("Line 5 - Value of c is %d\n", c );

c = a >> 2; /* 15 = 0000 1111 */

printf("Line 6 - Value of c is %d\n", c );

Output

Ex. No. | < Ex. Title>


18CS1002 PROGRAMMING FOR PROBLEM SOLVING LAB <REG. No.>

<Output snapshot here>

Result
Thus the bitwise operators c programming is verified successfully.

Ex. No. | < Ex. Title>

You might also like