程序1:
#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;
}
程序2:
#include<stdio.h>
#include<math.h>
int main(void)
{
double x,y;
printf("Enter x:");
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
}