#include <stdio.h>
unsigned int m(unsigned int x,unsigned int n);
int main(void)
{
int x,n,a;
printf("请输入无符号整数和右移循环次数\n");
scanf("%d%d",&x,&n);
a=m(x,n);
printf("右移循环后=%d",a);
return 0;
}
unsigned int m(unsigned int x,unsigned int n)
{
int s,i;
for(i=0;i<n;i++)
{
s=x&0x00000001;
x>>=1;
x+=s<<7;
}
return x;
}
时间: 2024-11-09 03:56:34