有以下程序 #include main() { int x=8; for( ; x>0; x--) {if(x%3) {

有以下程序 #include main() { int x=8; for( ; x>0; x--) {if(x%3) {printf("%d,",x--); cont
.有以下程序
#include
main()
{ int x=8;
for( ; x>0; x--)
{if(x%3)
{printf("%d,",x--);
continue;
}
printf("%d,",--x);
}
}
程序的运行结果是 ( )
A)7,4,2 B)8,7,5,2 C)9,7,6,4 D)8,5,4,2
ye78121 1年前 已收到1个回答 举报

凌小vv 幼苗

共回答了16个问题采纳率:93.8% 举报

#include
main()
{ int x=8;
for( ; x>0; x--)
{
if(x%3)
{
printf("%d, ",x--); cont
}}}
输出8 5 2

1年前 追问

4

ye78121 举报

.有以下程序 #include main() { int x=8; for( ; x>0; x--) {if(x%3) {printf("%d, ",x--); continue; } printf("%d, ",--x); } } 程序的运行结果是 ( ) A)7,4,2 B)8,7,5,2 C)9,7,6,4 D)8,5,4,2

举报 凌小vv

#include main() { int x=8; for( ; x>0; x--) //循环结束x自减 {if(x%3) {printf("%d, ",x--); //x=8时执行这段 输出8 x再自减一 x=7 循环结束 x=6 ;x=4执行这段 输出4 自减 x=3 循环结束再自减 x=2;x=2执行这段 输出2 自减 x=1 循环结束 x=0 退出循环 continue; } printf("%d, ",--x);//x=6时先自减x=5 输出5 循环结束 x=4 } }
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 2.257 s. - webmaster@yulucn.com