c语言编写任意进制转换
作者:互联网
/*N-scale transformation*/
#include<stdio.h>
#include<stdlib.h>
int main() {
int i=0,scale,integral,j,num[20];
printf("Please put a integral: ");
scanf("%d",&integral);
printf("Please put a scale: ");
scanf("%d",&scale);
/*Judging integral*/
do {
i++;
num[i]=integral%scale;
integral=integral/scale;
} while(integral!=0);
printf("The data has converted\n");
for(j=i; j>0; j--)
printf("%d",num[j]);
printf("\n");
system("pause");
return 0;
}
q1480040000
发布了9 篇原创文章 · 获赞 0 · 访问量 414
私信
关注
标签:scale,进制,int,Please,integral,num,printf,编写,任意 来源: https://blog.csdn.net/weixin_45713352/article/details/104458727