Problem Description
Larry graduated this year and finally has a job. He’s making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what’s been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a program to take his closing balance from each of the past twelve months and calculate his average account balance.
题解:求12个月的平均收入
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
float b,a=0;
for(i=0;i<12;i++)
{
scanf("%f",&b);
a+=b;
}
printf("$%0.2f\n",a/12);
return 0;
}
Financial Management
最新推荐文章于 2021-11-18 15:18:04 发布