Team Emertxe
Function and Pointer
Basics
Assignment 8
Assignment 8
Assignment 8
WAP to implement Circular Right shift
WAP to implement Circular Right shift
Input:
Assignment 8
WAP to implement Circular Right shift
Input: Read integer ‘num’(-ve and +ve) and number of bits
‘n’
Assignment 8
WAP to implement Circular Right shift
Input: Read integer ‘num’(-ve and +ve) and number of bits
‘n’
Output:
Assignment 8
WAP to implement Circular Right shift
Input: Read integer ‘num’(-ve and +ve) and number of bits
‘n’
Output: Print the updated value of ‘num’ after shifting bits
towards right in binary format.
Assignment 8
Example’s:
Assignment 8
Example’s:
➢ Input: num = 12 and n = 3
Assignment 8
Example’s:
➢ Input: num = 12 and n = 3
➢ 32 bit binary representation of num 12 :
Assignment 8
Example’s:
➢ Input: num = 12 and n = 3
➢ 32 bit binary representation of num 12 :
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
Example’s:
➢ Input: num = 12 and n = 3
➢ Shift ‘num’ 3 times towards right.
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Example’s:
➢ Input: num = -12 and n = 3
Assignment 8
Example’s:
➢ Input: num = -12 and n = 3
➢ 32 bit binary representation of num -12 :
Assignment 8
Example’s:
➢ Input: num = -12 and n = 3
➢ 32 bit binary representation of num -12 :
Assignment 8
1 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1 1 0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
Example’s:
➢ Input: num = -12 and n = 3
➢ Shift ‘num’ 3 times towards right.
Assignment 8
1 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1 1 0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1 1
1
1
1
1
1
1
1
1
1
1
1
1
0
0 1 0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Example’s:
➢ Input: num = 15 and n = 2
Assignment 8
Example’s:
➢ Input: num = 15 and n = 2
➢ 32 bit binary representation of num 15 :
Assignment 8
Example’s:
➢ Input: num = 15 and n = 2
➢ 32 bit binary representation of num 15 :
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
Example’s:
➢ Input: num = 15 and n = 2
➢ Shift ‘num’ 2 times towards right.
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1 0
0
0
0
0
0
0
0
0
0
0
0
0
0
1 0 1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
Example’s:
➢ Input: num = 1 and n = 1
Assignment 8
Example’s:
➢ Input: num = 1 and n = 1
➢ 32 bit binary representation of num 1 :
Assignment 8
Example’s:
➢ Input: num = 1 and n = 1
➢ 32 bit binary representation of num 1 :
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Example’s:
➢ Input: num = 1 and n = 1
➢ Shift ‘num’ 1 time towards right.
Assignment 8
0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Sample execution:-
Assignment 8
Sample execution:-
Assignment 8
Pre-requisites:-
Assignment 8
Pre-requisites:-
➢ Bitwise operators
Assignment 8
Pre-requisites:-
➢ Bitwise operators
➢ Functions
Assignment 8
Pre-requisites:-
➢ Bitwise operators
➢ Functions
Objective:-
Assignment 8
Pre-requisites:-
➢ Bitwise operators
➢ Functions
Objective:-
To understand the concept of
➢ Bitwise operations
Assignment 8
Pre-requisites:-
➢ Bitwise operators
➢ Functions
Objective:-
To understand the concept of
➢ Bitwise operations
➢ Functions
Assignment 8
Team Emertxe
Thank you

08_circular_right_shift.pdf