本人刚学 这个错在那里啊 谢谢
#include"stdio.h"main()
{
int x,day;day=10;x=1;
while(day>1)
{
x=2x+2;
day--;
}
printf("总共有%d个桃子\n",x);
}
#include"stdio.h" int main() { //Local declarations int day=10; int x=1; //statements while(day>1) { x=2*x+2; day--; } printf("总共有%d个桃子\n",x); return 0; } //main
#include<stdio.h> //global declaration int day; //function declarations int sum_fun(int num); int main() { //statements scanf("%d",&day); printf("总共有%d个桃子\n",sum_fun(1)); return 0; } //main int sum_fun(int num) { // local declaration int sum_peach=1; // statements if(num==day) return 1; else return 2*(sum_fun(num+1)+1); }//sum_fun