#include
#include
int main(int argc, char *argv[]) { int i = 0; int tmp = 0; if(argc > 1) { while((--argc) >= 1) { tmp = atoi(argv[argc]); i = 0; while(tmp%2 == 0) { i++; tmp >>= 1; } printf("argv[%d] is %d , and it has %d zeros./n", argc, atoi(argv[argc]),i); } return 0; } else { printf("ERRER INPUT! /n"); return 1; } } 一个数的二进制后面有多少个0, 用命令行方式输入.
求一个整数的二进制后面有多少个0
最新推荐文章于 2023-04-03 16:49:13 发布