私はプログラミングが初めてで、プログラムに特定の数値を取り、それを2倍にしてから、ユーザー入力が何日も2倍になり続けようとしています。私はこのループを作成しましたが、動作しますが、最終的な数値は負になります。どうすればネガティブになるのを止めることができるのかわかりません。助けていただければ幸いです。
int main(void)
{
int d;
int s;
float a;
do
{
printf ("Please enter the amount of days in the month: ");
d = GetInt();
} while (d > 31 || d < 28);
do
{
printf("Please enter the amount of pennies you start will start with: ");
s = GetInt();
} while( s < 0);
do
{
s = s * 2;
d = d - 1;
a = s / 100.0;
printf("%f\n", a);
} while(d > 0);
return 0;
}