while(x>=(y+1)*(y+1)) {
@ y++;
}
(8) x=91; y=100;
while(y>0) {
@ if(x>100) { x -= 10; y--; }
else x++;
}
解:(1) n-1
(2) n-1
(3) n-1
(4) n+(n-1)+(n-2)+...+1=n(n+1)/2
考研资讯2018-12-12三水老师
while(x>=(y+1)*(y+1)) {
@ y++;
}
(8) x=91; y=100;
while(y>0) {
@ if(x>100) { x -= 10; y--; }
else x++;
}
解:(1) n-1
(2) n-1
(3) n-1
(4) n+(n-1)+(n-2)+...+1=n(n+1)/2