编程学习网为您整理以下代码实例,主要实现:生成未来值利息因素表(VIF),希望可以帮到各位朋友。
#include <stdio.h>
#include <math.h>
#define MAX_INTEREST 6
#define MAX_PERIOD 10
int main()
{
int interest;
float fvif;
printf("\nRate of interest varIEs from 1% to 6%.");
printf("\nPeriod varIEs from 1 year to 10 years.");
printf("\n\n Interest Rate ");
printf("\nPeriod");
for (int i=1; i<= MAX_INTEREST; i++){
printf("\t %d%", i);
}
for(int years=1; years <= MAX_PERIOD; years++) {
printf("%d\t", years);
for(interest=1; interest <= MAX_INTEREST; interest++) {
fvif = pow((1+interest*0.01), years);
printf("%6.3f\t", fvif);
}
printf("\n");
}
return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!