例:1
00000000 00000000 00000000 00000001
逆序之后是:
10000000 00000000 00000000 00000000
#include<stdio.h> #include<stdlib.h> int main() { int n = 0; int num =0; int i = 0; scanf( "%d", &n); for (i = 0; i < 32; i++) { num = num << 1; num |= ((n>>i)&1); } printf( "n=%d num=%d\n", n,num); system( "pause"); return 0; }
本文出自 “11132019” 博客,请务必保留此出处http://11142019.blog.51cto.com/11132019/1760092
原文地址:http://11142019.blog.51cto.com/11132019/1760092