Generate a Table of Future Value Interest Factors (FVIFs) - C Data Type

C examples for Data Type:float

Description

Generate a Table of Future Value Interest Factors (FVIFs)

Demo Code

#include <stdio.h>
#include <math.h>

#define  MAX_INTEREST  6//from w  w w . j  a  v a2  s .  c  o  m
#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;
}

Related Tutorials