forked from snehavvv/code-with-error
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexttttttt
More file actions
26 lines (22 loc) · 793 Bytes
/
texttttttt
File metadata and controls
26 lines (22 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public class DebugExample {
public static void main(String[] args) {
int[] numbers = {10, 20, 30, 40, 50};
// Print the sum of all numbers in the array
int sum = 0;
for (int i = 0; i < numbers.length; i++)
{
sum += numbers[i];
}
System.out.println("Sum: " + sum);
// Find the maximum number in the array
int max = numbers[0];
for (int j = 1; j < numbers.length; j++) {
if (numbers[j] > max)
max = numbers[j];
}
System.out.println("Maximum number: " + max);
// Calculate the average of all numbers in the array
double average = (double) sum / numbers.length;
System.out.println("Average: " + average);
}
}