有以下程序 main() { int t=1,i=5; for( ; i>=0; i--) t*=i; printf("%d\n",t); } 执行后输出结果是【 】。

admin2010-01-10  23

问题 有以下程序
   main()
   {  int  t=1,i=5;
   for( ; i>=0;  i--) t*=i;
   printf("%d\n",t);
   }
   执行后输出结果是【  】。

选项

答案0

解析 本题中的for循环共执行了6次,每执行一次将相应i的值相乘,最后当i=-1时停止循环。该for循环执行完后t的值为5*4*3*2*1*0=0,故最后输出t的值为0。
转载请注明原文地址:https://kaotiyun.com/show/XUWp777K
0

最新回复(0)