c语言编程中出现error:";"expected(got"amount")的情况是什么问题

#include<stdio.h>
int main(void)
{
float loan amount,interest rate,monthly payment,first,second,third,month interest rate;

printf("Enter amount of loan:");
scanf("%.2f",&loan amount);
printf("Enter interest rate:");
scanf("%.1f",&interest rate);
printf("Enter monthly payment:");
scanf("%.2f",&monthly payment);

month interest rate =interest rate /(100*12);
first =loan amount*(1+month interest rate)-monthly payment ;
second =first*(1+month interest rate)-monthly payment;
third =second*(1+month interest rate)-monthly payment ;

printf("Balance remaining after first payment :$%.2f\n",first);
printf("Balance remaining after second payment:$%.2f\n",second);
printf("Balance remaining after third payment:$%.2f\n",third);

return 0;
}

变量名中不能有空格。如果你想定义一个名为loan amount的变量将其写成loan_amount。
另外scanf不支持指定精度。
温馨提示:答案为网友推荐,仅供参考
相似回答