标签:
#include<stdio.h>
#include<math.h>
int main(void)
{
int money,year;
double rate,sum;
printf("Enter money:");
scanf("%d",&money);
printf("Enter year:");
scanf("%d",&year);
printf("Enter rate:");
scanf("%lf",&rate);
sum=money*pow(1+rate,year);
printf("sum=%.2f\n",sum);
return 0;
}
#include<stdio.h>
#include<math.h>
int main(void)
{
double x,y;
printf("Enter x:\n");
scanf("%lf",&x);
if(x<0){
y=pow(x,5)+2*x+pow(x,-1);
}
else {
y=sqrt(x);
}
printf("y=f(%f)=%.2f\n",x,y);
return 0;
}
由于网络原因未能上传第二周作业,在未知网络错误的情况下经由老师提醒,补交第二次作业,见谅。另相较于上一次手动输入代码时间缩短了很多,我发现c语言确实是一门熟能生巧的课业,今后也会勤加练习
标签:
原文地址:http://www.cnblogs.com/shenayunsi00/p/5922145.html