/* 将输入数的二进制形式输出 */ |
#include <stdio.h> |
void dec_bin( const int x) { |
if (x / 2 > 0) { |
dec_bin(x / 2); |
printf ( "%d" , x % 2); |
} else |
printf ( "%d" , x); |
} |
int main( void ) { |
int data = 0; |
printf ( "Please input a number: " ); |
scanf ( "%d" , &data); |
/* 打印输入数的二进制形式 */ |
printf ( "The %d's binary mode is: " , data); |
dec_bin(data); |
printf ( "\n" ); |
return 0; |
} |
by: 发表于:2017-08-14 11:30:26 顶(0) | 踩(0) 回复
??
回复评论