下面代码段的执行结果是
int i, s = 0 ;
int a[ ] = { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 };
for ( i = 0 ; i < a.length ; i ++ )
if ( a[i]%3 = = 0 ) s += a[i] ;
System.out.println("s="+s);
int i, s = 0 ;
int a[ ] = { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 };
for ( i = 0 ; i < a.length ; i ++ )
if ( a[i]%3 = = 0 ) s += a[i] ;
System.out.println("s="+s);
举一反三
- 程序运行的结果是 。 import java.io.* ; public class abc { public static void main(String args[ ]) { int i , s = 0 ; int a[ ] = { 10, 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 }; for ( i = 0 ; i < a.length ; i ++ ) s += a[i] ; System.out.println("s="+s); } }
- 设有数组定义:int MyIntArray[ ] = { 10 , 20 , 30 , 40 , 50 , 60 , 70}; 则执行以下几个语句后的输出结果是______ :int s = 0;for(int i = 0 ; i
- 中国大学MOOC: 下面程序执行后的输出结果是( )。#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue; if (i==6) break; i++; s+=i; }; printf(%d,s); return 0;}#include int main(){ int i=0,s=0; for (;;) { if(i==3||i==5) continue;
- 【单选题】下面程序执行后的输出结果是()。#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0;for (;;) {if(i==3||i==5) continue;if (i==6) break;i++; s+=i;};printf("%d",s); return 0;}#include <stdio.h>int main(){int i=0,s=0; A. 10 B. 13 C. 21 D. 死循环
- 下面运行输出的结果为int s=3;for(int i=0;i<;5;i++){if(i==3){continue;}s++;}System.out.println(s);