qq_慕神8384246
2019-02-03 15:35
#include <stdio.h>
int main ()
{
int x,i;
x=1;
for(i=9;i<=1;i--)
{
x=x*2+2;
switch(i)
{
case 9:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 8:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 7:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 6:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 5:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 4:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 3:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 2:printf ("第%d天所剩桃子%d个\n",i,x);
break;
case 1:printf ("第%d天所剩桃子%d个\n",i,x);
break;
}
}
}
for(i=9;i>=1;i--)
for循环中应该是i≥1
C语言入门
926206 学习 · 20797 问题
相似问题