my advance thanks to anyone who can help me in this program. the problem is the program only calculates the first month only it does not follow up can someone help in it??? i know its very beginner its for school project. please note that i only can use microsoft visual studio plus i can't use #include<iostream>.
it has to be #include<stdio.h> and void main(void).
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main(void)
{
float monthlyPayment;
float balance;
float interestRate;
float cout;
float rate;
float remainder, remainder1, remainder2;
float balance1;
int choice;
printf("This progame will calculate your monthly compound interest:\n");
printf("Enter a choice [ 0=Quit, 1=calculate compound interest] :\n");
scanf("%d", &choice);
switch (choice)
{
case 0 : printf("Bye Bye!!");
break;
case 1 :
printf("Enter the current balance of your loan: ");
scanf("%f", &balance);
printf("Enter the interest rate (compounded monthly) : ");
scanf("%f",&interestRate);
printf("Enter the desired monthly payment : ");
scanf("%f", &monthlyPayment);
break;
default : printf(" invalid.");
printf("bye bye");
}
if (interestRate >= 1)
{
rate = interestRate / 100;
The code that coder777 gave you is a loop. When you look at a loop (in this case a do{} while() loop) you can see that any code that you want executed goes in between the do squiggly braces of the do{} part of the loop, like this:
1 2 3 4 5 6 7 8
do
{
/*Insert some code here
put more of the code here
....
....
....*/
}
The while conditional statement determines how long the loop will last. In this case, you will continue to run the program until you enter 0. For safety, I would recommend adding in a check to make sure the user has not put in a wrong value. For example, the program will still run if one were to put in 5, although 5 is not a valid choice for your program.