Here is my question:
Write a program that reads from the keyboard an initial balance b, the annual rate of interest r and the projected balance you want to reach.
The program should then display the number of monthe it will take for the balance to reach the projected balance.
I am given this equation, the blance after one month time will be b*(1+r/1200).
My problem here is that i am not able to display the number of months. For example for initial balance i enter 10 projected balance 12 and rate on interest 10/100 my output should be number of months = 2. But it displays 10, 11, 12. I am not able to correct it i am stuck.
here are my codes:
#include<stdio.h>
#include<stdlib.h>
// This program will display the number of month it will take to reach the projected baance.
int main()
{
int count, n, b, r, p;
printf("Enter initial balance: ");
scanf("%d", &b);
printf("Enter projected balance: ");
scanf("%d", &p);
printf("Enter annual rate: ");
scanf("%d", &r);
n=b*(1+(r/1200));
for(count=n;count<=p;count++){
printf("The number of month to reach the projected balance is %d\n", count);
}
system("pause");
return 1;
}