I have done this code and I have made a loop where my code will restart from scratch however I want the program to restart while changing the month date and also asking the user how many months they would like so the program will run a certain amount of times, as I have added the month 1 being the first month.
#include<stdio.h>
#include<stdlib.h>
float twag(float amount,float rate)
{
float si;
si = (amount * rate) / 100;
return si;
}
float twag2(float amount,float rate)
{
float er;
er = twag(amount, rate) + amount;
return er;
}
int main()
{
char answer;
do {
float amount;
float rate;
float si;
float er;
printf("Month1\n");
printf("\nEnter intial deposit : ");
scanf("%f", &amount);
printf("\nEnter Rate of Interest : ");
scanf("%f", &rate);
printf("\nSimple Interest : %.2f \n", twag(amount,rate));
printf("\nEnd Payment: %.2f \n",twag2(amount,rate));
if (amount <= 100)
printf("interest rate should be 10%%\n");
else if (amount <= 200)
printf("interest rate should be 50%%\n");
else if (amount <= 500)
printf("interest rate should be 80%%\n");
else if (amount >= 500)
printf("interest rate should be 90%%\n");
system("PAUSE");
printf("\nPress Y to continue to the second month or Press any Key To
Exit");
scanf(" %c", &answer); //
}
while (answer == 'y' || answer == 'Y');
return 0;
}