public class Test { public static void main(String[] agrs) { int i, s = 0; int a[] = { 10, 20, 30,
publicclassTest{publicstaticvoidmain(String[]agrs){inti,s=0;inta[]={10,20,30,40,50,60...
public class Test {
public static void main(String[]agrs) {
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);
}
}
}
}
程序的输出结果为: 展开
public static void main(String[]agrs) {
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);
}
}
}
}
程序的输出结果为: 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询