#include <cs50.h>
#include <stdio.h>
int main(void)
{
// TODO: Prompt for start size
int s;
do
{
s = get_int("Start size : ");
}
while (s < 9);
// TODO: Prompt for end size
int e;
do
{
e = get_int("End size : ");
}
while (e < s);
// TODO: Calculate number of years until we reach threshold
int n = s;
int y = 0;
while (n < e)
{
n = n + n / 3 - n / 4 ;
y++;
}
// TODO: Print number of years
printf("Years: %i\n", y);
}
I am able to run the above code perfectly and get the desired results. However when i try to replace the n's calculation part by simplifying the math the code stops working i.e it does not calculate what its intended to calculate and keeps the program in the input taking mode i.e it lets you type in the terminal without giving output. I replaced the n's calculation part with n = (13 * n) / 12