Friday, March 28, 2014

Print 5% increase in interest on amount per year using for loop and pow function

#include<stdio.h>
#include<math.h>   // used bcoz of pow
void line()
{
int i;
    printf("\n");
for(i=1;i<=35;i++)
    printf("=");
}
void header()
{
printf("\n");
printf(" Built and Designed by Arslan Malik");
printf("\n");
}
int main()
{
line();
header();
line();
int years;
double amount;
int deposit;
double interest=.05;
printf("\nEnter the amount you have borrowed : \n");
scanf("%d",&deposit);
for(years=1;years<=10;years++)
{


     amount=deposit*pow(1+interest,years);
     printf("\nYour interest for %d year is : %21.2f\n",years,amount);
}
return 0;
}

No comments:

Post a Comment