2025-03-06 19:56:07 +08:00

16 lines
566 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
61.【程序功能】猴子吃桃,猴子第一天摘下若干个桃子, 吃了总数的一半,还不过瘾,又多吃了一个。第二天又将剩下的桃子吃掉一半,又多吃了一个。以后每天都这样吃。到第十天时, 发现只有一个桃子了。编程求第一天摘了多少个桃子。(注使用for循环
-------------------------------------------------------*/
#include <stdio.h>
void main() {
int i,t;
t=1;
/**********Program**********/
for(i=0;i<9;i++){
t=(t+1)*2;
}
/********** End **********/
printf("第一天共摘了%d只桃\n",t);
}