كود:
import java.util.scanner;
كود:
public class hact3 {
public static void main(string[] args) {
scanner in = new scanner(system.in);
system.out.print("enter numbers [entering 0 exits the program]: ");
int n = in.nextint();
int count = 1, max = 0;
for (; ;) {
if (n == 0)
break;
if (n > max) {
max = n;
count = 0;
}
if (n == max)
count++;
system.out.print("enter numbers [entering 0 exits the program]: ");
n = in.nextint();
}
system.out.println("\nthe largest number is " + max);
system.out.print("the occurrence count of the largest number is " + count);
}
}