Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
public class Main { public static void main(String[] args) { int[] points = {72, 95, 61, 88, 79}; int count = 0; int sum = 0; int max = points[0]; boolean found = false; for (int p : points) { if (p > 80) { // Count count++; } sum += p; // Sum if (p > max) { // Max max = p; } if (p == 100) { // Search found = true; } } System.out.println("More than 80 points: " + count); System.out.println("Total points: " + sum); System.out.println("Best score: " + max); System.out.println("Anyone with 100? " + found); } }
More than 80 points: 2
Total points: 395
Best score: 95
Anyone with 100? false