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

#include <stdio.

h>

void main()
{
int rightrot(int,int);
int x,n,result;
printf("\n Enter no to be right rotated ");
scanf("%d",&x);
printf("\n Enter the number to bits to be right rotated ");
scanf("%d",&n);
result=rightrot(x,n);
printf("\n\n The number %d after right rotation by %d bit positions is %u
",x,n,result);
return 0;
}
int rightrot(int a,int b)
{
int p,q;
p=a>>b;
q=a<<(32-b);
return(p|q);

You might also like