翁恺老师的逆序
#include<stdio.h>
int main()
{ printf("请输入三位数的数据");
int shu = 0;
scanf("%d",&shu);
int a = shu %10;//三位数的数据在进行除10后 会得到前两位数 对它进行取余数将会得到个位数
int b = shu %100 /10;/*进行除100后将会得到百位上的数据 而留下个十位上的数据作为余数同时除10 算法将会留下十位上的数据*/
int c = shu /100;//除100得到百位上的数据
int d = a*100 + b*10 + c;/*计算输出结果 将个位上的数据*100 变为百位 因为十位上的数据是单个的所以*10 百位不变输出为个位*/
printf("你的结果为%d",d);
return 0 ;
}
简单的找零机器 当时还没学eles
#include<stdio.h>
int main()
{ int 价格 = 0;
int 票面 = 0 ;
printf("请你输入价格");
scanf("%d",&价格);
printf("请你输入票面");
scanf("%d",&票面);
int a =0;
a = 票面 - 价格;
if (a<0){printf("你的价格不足");}
if(a>0){printf("找你%d元",a);}
return 0 ;
}