c语言练习28——算年龄

#include<stdio.h>
#include<stdlib.h>
/*题目:有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第3个人大2岁。问
第三个人,又说比第2人大两岁。问第2个人,说比第一个人大两岁。最后问第一个人,他说是10岁。请问第五个人多大?*/
int main(){
int i,age=10;
for(i=0;i<4;i++)
age=age+2;
printf("第五个人岁数为:%d岁",age);
return 0;
}
   

猜你喜欢

转载自www.cnblogs.com/gougouwang/p/11415397.html