i have to make a program to print out the following:

Enter a principal amount:

1000

Enter an annual interest rate:

7

Your first month of interest will be: $5.83

Enter the number of years your money will be in the bank:

30

You plan to deposit $1000.00 for a term of 30 years.

The total amount of interest you will earn will be $7116.50

Your final balance will be $8116.50.

i have tried numerous things to solve this but everything i do is wrong. my while loop keeps returning extremely large numbers. my code looks like this.

any help will be greatly appreciatedCode:`#include <stdio.h>`

int main()

{

double principal, interest_rate, balance, interest;

int months, total_months, total_years;

total_months = 12 * total_years;

months = 1;

balance = interest + principal;

printf("Enter a principal amount:\n");

scanf("%lf", &principal);

printf("Enter an annual interest rate:\n");

scanf("%lf", &interest_rate);

printf("Your first month of interest will be: $%0.2lf\n", interest_rate / 12 * (principal / 100));

printf("Enter the number of years your money will be in the bank:\n");

scanf("%d", &total_years);

printf("You plan to deposit $%0.2lf for a total of %d years.\n", principal, total_years);

while(months <= total_months)

{

interest = principal + (interest_rate / 12 * (principal / 100));

interest += principal;

months++;

}

printf("The total amount of interest you will earn will be %0.2lf\n", interest - principal);

printf("Your final account balance will be %0.2lf\n", balance);

return 0;

}