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

main()  /* Annuity */
{
  int p, m;
  float s, r, n, j;
  double pow(double x, double y);

  printf("This program determines the eventual cash value of an annuity.\n");
  printf("enter dollar amount paid per year: \n");
  scanf("%f", &r);
  printf("enter number of installments per year: \n");
  scanf("%d", &p);
  printf("enter duration of annuity in years: \n");
  scanf("%f", &n);
  printf("enter nominal interest rate: \n");
  scanf("%f", &j);
  printf("enter number of conversions per year: \n");
  scanf("%d", &m);
  s = (r*(((pow((1+(j/m)),(m*n)))-1)/(p*((pow((1+(j/m)),(m/p)))-1))));
  printf("The eventual cash value is $%.2f.\n", s);
}

