Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Z5_NizBr {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int num = 0;
- int temp;
- int count = 0;
- do {
- System.out.println("Enter a number: ");
- temp = input.nextInt();
- if (temp > num) {
- num = temp;
- count = 1;
- } else if (num == temp) {
- count++;
- }
- } while (temp != 0);
- System.out.println("Greater number is " + num + " and has occurred "
- + count + " times");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement