(1)c基础代码
#include <stdio.h>
#include <stdio.h>
#include <stdio.h>
int main()
{
int a;
int b;
printf("输入两个整数");
scanf("%d %d" , &a, &b);
printf("%d + %d = %d \n", a , b , a+b);
return 0;
}
#include <stdio.h>
int main()
{
const int AMOUNT = 100;
int price = 0;
printf("请输入商品的价格:");
scanf("%d",&price);
int charge = AMOUNT - price ;
printf("%d" , charge);
return 0;
}
#include <stdio.h>
int main()
{
printf("身高的英尺和英寸输入");
double foot = 0;
double inch = 0;
scanf("%lf %lf" , &foot , &inch);
double t = ( foot + inch/12 )*0.3048;
printf("%f", t);
return 0;
}
#include <stdio.h>
int main()
{
int hour1,minute1;
int hour2,minute2;
printf("之前的时间:");
scanf("%d %d" , &hour1, &minute1);
printf("之后的时间:");
scanf("%d %d", &hour2 , &minute2);
int before = hour1*60 + minute1;
int after = hour2*60 + minute2;
int time = after -before;
printf("时间相差了 %d 小时 %d 分钟", time/60 , time%60);
return 0;
}
#include <stdio.h>
int main()
{
int a = 0;
int b = 0;
printf("进行大小的比较,请输入两整数的值:");
scanf("%d %d", &a, &b);
double avg = (a+b)/2.0;
printf("a 和 b 的平均值是 %f", avg);
return 0;
}
#include <stdio.h>
int main()
{
int a = 0;
scanf("%d" ,&a);
int b = (a%100 )%10 * 100 +(a/10)%10 *10 +( a/100 );
printf("倒序的数字是 %d" , b);
return 0;
}

浙公网安备 33010602011771号