Hey I'd really appreciate some help on my homework assignment, I'm just beginning to learn loops and I can't figure out why it isn't working. I attached a screenshot of what the output it supposed to be, but when I run mine it outputs that the volume is 0 after 1082801280 regardless of what I enter into it. Any help would be great hopefully I'm not doing anything too dumb.
Code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
//declare variables
double time = 0;
double water = 500;
double watergain;
double waterloss = 0;
//opening statement
printf("Please enter the additional gallons of water needed every hour: ");
scanf("%d", &watergain);
while (water > 100) {
printf("The volume is %d after %d hours\n", water, time++);
waterloss = (10 * water) / 100;
water = water - waterloss + watergain;
}
system("pause");
return (0);
}