You are on page 1of 5

EXPERIMENT NUMBER – 1.

2a
STUDENT’S NAME – Aaryan Saharan
STUDENT’S UID – 22BAI70933
CLASS AND GROUP – 102/B
SEMESTER –1

AIM OF THE EXPERIMENT –

 Learn how to use operators and apply decision making in c using if-else, how to
use bitwise, conditional, arithmetic operators.

TITLE OF THE EXPERIMENT-

 Write a program which implements the working of all bitwise operators.

FLOWCHART/ ALGORITHM -

we take the input


from the users
for two numbers.

we perform the
bitwise operations
on them

we print the
values.
SUBJECT NAME-Introduction to Problem Solving Lab SUBJECT CODE-22CSH101
PROGRAM CODE -

#include<stdio.h>
int main()
{
int num , num1 , nd , orrr ,xxxor , neg ,left ,right ;
printf("pls input two numbers");
scanf("%d %d", &num , &num1);
nd= num & num1;
orrr = num | num1;
xxxor= num ^ num1;
neg= ~num ;
left= num << 2;
right= num >> 2;

printf("bitwise and value is %d\n " ,nd );


printf("bitwise or value is %d\n " ,orrr );
printf("bitwise xor value is %d\n " ,xxxor );
printf("bitwise negation value is %d\n " ,neg );
printf("bitwise left shift value is %d\n " ,left );
printf("bitwise right shift value is %d \n" ,right);

SUBJECT NAME-Introduction to Problem Solving Lab SUBJECT CODE-22CSH101


ERRORS ENCOUNTERED DURING PROGRAM’S EXECUTION -

(Kindly note down the compile time errors encountered)

 Warning] missing terminating " character


 [Error] expected ')' before ';' token
 [Error] '’xor’ was not declared in this scope

PROGRAMS’ EXPLANATION (in brief) –

Its kinda same to what we did in arithmetic operation here we are taking input from
users and them using operations knowns as bitwise operator which apply on bit value
of the numbers instead of their actual value.

OUTPUT -

SUBJECT NAME-Introduction to Problem Solving Lab SUBJECT CODE-22CSH101


LEARNING OUTCOMES -
Identify situations where computational methods would be useful.

Approach the programming tasks using techniques learnt and write pseudo-code.

Choose the right data representation formats based on the requirements


of the problem.
Use the comparisons and limitations of the various programming
constructs and choose the right one for the task.

EVALUATION COLUMN (To be filled by concerned faculty only) -

Sr. No. Parameters Maximum Marks


Marks Obtained
1. Worksheet Completion 10

2. Viva 8

3. Conduct 12

Total Marks 30

SUBJECT NAME-Introduction to Problem Solving Lab SUBJECT CODE-22CSH101

You might also like