
Java
- 5 ответов
- 0 вопросов
3
Вклад в тег
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <=100; i++) {
if(i%9 != 0 ){
sum+=i;
}
}
System.out.println("sum = " + sum);
}
public static void main(String[] args) {
int sum = IntStream.range(1, 100).filter(i -> (i%9!=0)).sum();
System.out.println("sum = " + sum);
}