第一种解法:
#include <stdio.h>
int main() {
float minute;
int age;
printf("请输入你的年龄:\n");
scanf_s("%d", &age);
minute = age * 3.156e7;
printf("你的年龄对应的秒数为:%f", minute);
return 0;
}
第二种解法:
#include <stdio.h>
#define Year 3.156e7
int main(void)
{
float age,minute;
printf("Enter how many years old you are:\n");
scanf("%f",&age);
minute = age * Year;
printf("你的年龄所对应的秒数为:%f\n",minute);
return 0;
}
第二题:
# include <stdio.h>
# define water 3.0e-23
# define kuatuo 950
int main(void)
{
float number ,a;
printf("请输入水的夸脱数:\n");
scanf_s("%f", &number);
a = number * kuatuo / water;
printf("其对应的水分子数量为:%f\n", a);
return 0;
}
第三题:
# include <stdio.h>
#define yincun 2.54
int main(void)
{
float shengao,a;
printf("请输入你的身高(英寸):\n");
scanf_s("%f", &shengao);
a = shengao * yincun;
printf("你的身高为:%f(cm)\n", a);
return 0;
}