标签:c语言
# include <stdio.h> # include <string.h> int main(void) { int i,n,q,r,s[100]; while(scanf("%d", &n) != EOF) { getchar(); //吸收回车符。 if(n < 0) break; for(i = 0;; i++) { q = n / 8; //printf("%d\n", q); r = n % 8; if(q == 0) { s[i] = r; break; } s[i] = r; n = q; } //printf("---%d\n", i); for(; i >=0; i--) { printf("%d", s[i]); } printf("\n"); } return 0; }
标签:c语言
原文地址:http://blog.csdn.net/xu758142858/article/details/44120631