|
程序代码:
#include<stdio.h>
#include<stdlib.h>
int main()
{
float principal,rate,interest;
int days;
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);
while(principal!=-1)
{
printf("enter interest rate:");
scanf("%f",&rate);
printf("enter term of the loan in days:");
scanf("%d",&days); //这行
interest=(float)principal*rate*days/365;
printf("the interest charge is:$%.2f\n",interest);
printf("enter loan principal (-1 to end):");
scanf("%f",&principal);
}
system("pause");
return 0;
} |
|