If this problem is not considered in C language programming, purely mathematical thinking, the problem is very simple. We can list a few, 2 yuan can drink 3 bottles, 3 yuan can drink 5 bottles, 4 yuan can drink 7 bottles, 5 Yuan can drink 9 bottles, we are not difficult to find if there is n yuan, you can drink 2*n-1 bottles. The problem is very simple.
#define N
int main ()
{
printf ("Drink up to%d bottles \ n", 2*n-1);
return 0;
}
This is a method that also has the logic to complete this question:
1 yuan per bottle of soda, two empty bottles for a bottle of soda. 2n-1 bottle (n yuan);
int main ()
{
int money = 0;
int count = 0;
printf ("Please enter money:");
scanf ("%d", &money);
Count = money;
while (1)
{
if (2!= 0)
{
count = count + money-1;
break;
else
{Money
= MONEY/2;
Count + = money;
}
}
printf ("Altogether can buy:%d\n", count);
System ("pause");
return 0;
}