题目:一年约3.156X10 ^ 7秒,编写程序,输入年龄,输出相应秒数。
分析:需用到函数pow()
#include <stdio.h>
#include <math.h>
int main()
{
float age;
printf("输入年龄\n");
scanf("%f", &age);
printf("%.2f秒", age*3.156*pow(10,7));
return 0;
}
该程序使用C语言编写,根据用户输入的年龄,计算出相应的秒数,具体实现通过乘以一年大约3.156乘10的7次方秒。程序中运用了数学库函数pow()。
题目:一年约3.156X10 ^ 7秒,编写程序,输入年龄,输出相应秒数。
分析:需用到函数pow()
#include <stdio.h>
#include <math.h>
int main()
{
float age;
printf("输入年龄\n");
scanf("%f", &age);
printf("%.2f秒", age*3.156*pow(10,7));
return 0;
}
3445

被折叠的 条评论
为什么被折叠?
