我这有个程序,也许对你有用哦!
#include <stdio.h>
void main()
{
int x,y;
printf("No.1:Input a Decimal number,"
"Output a Decimal number:\n Input a Decimal:\n");
scanf("%d",&x);
printf("The Decimal Number is:%d\n",x);
printf("No.2:Input an Octal number,"
"Output a Decimal number:\n Input a Octal:\n ");
scanf("%o",&x);
printf("The Decimal Number is:%d\n",x);
printf("No.3:Input a Decimal number,"
"Output a Hexadecimal number:\n Input a Decimal:\n");
scanf("%d",&x);
printf("The Hexadecimal Number is :%x\n",x);
x=100;y=050;
printf("(1)%d,(2)%o,(3)%x\n",x+y,x+y,x+y);
/*其中,“Octal number”、“Decimal Number”和“Hexadecimal number”分别表示八进制数、十进制数和十六进制数*/
}