首页 > 试题广场 >

写出下列程序的运行结果:

[问答题]
写出下列程序的运行结果:

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 ++ )

if ( a[i]%3 = = 0 )  s += a[i] ;

System.out.println("s="+s);

}

}

s = 180

发表于 2017-05-17 02:40:07 回复(0)
30+60+90=180
发表于 2018-09-13 15:07:19 回复(0)