/* Note:Your choice is C IDE */ #include "stdio.h" #include "math.h" void main() { int num=65; int indiv,ten,place; /*定义的分别为个位,十位,位数*/ printf("\n请输入一个整数(0~99):"); printf("%d",num); if (num>9) place=2; else place=1; printf("\n位数=%d",place); printf("\n每位数字为:"); ten=num/10; indiv=(int)(num-ten*10); switch(place) { case 2:printf("%d,%d",ten,indiv); printf("\n反序数字为:"); printf("%d%d\n",indiv,ten); break; case 1:printf("%d",indiv); printf("\n反序数字为:"); printf("%d\n",indiv); break; } printf("\nID:2013304118"); }
运行结果:
(1)int num=60
(2)int num=98
总结:
(1)输入的符号要注意是英文还是中文输入法的,这个决定着程序是否能成功运行。
(2)多练习才能打得快,打得好;多留心才会使程序更易让人看得懂。