SumThree

xiaoxiao2021-02-28  16

public class SumThree { public static void main(String[] args) { // TODO Auto-generated method stub //12.通过终端输入 10 个整数,计算 10 个整数中所有能被 3 整除的数的合。  int[] a = {3,0,6,2,5,9,4,18,1,6}; int sum = 0; for (int i = 0; i < a.length; i++) { if (a[i]%3==0) { sum+=a[i]; } } System.out.println(sum); } }
转载请注明原文地址: https://www.6miu.com/read-2799992.html

最新回复(0)