标签:
#include <stdio.h> #include <stdlib.h> int main() { int a[100],s[100],i,n,r,k; printf("input a number\t"); scanf("%d",&n); //输入一个数 printf("input r\t"); scanf("%d",&r); //转化为r(二进制,十进制) k=1; do { a[k]=n%r; k++; n = n/r; }while(n>0); for(i=k-1;i>0;i--) printf("%d",a[i]); return 0; }
标签:
原文地址:http://www.cnblogs.com/boyiliushui/p/4490635.html