import java.util.Scanner;
//The class name
public class OccurenceofMaxNumbers{
public static void main(String[]args){
//Taking the datas from users
Scanner input =new Scanner(System.in);
//Specifying values intervals
int sayı=0,max,count=0;
System.out.println("sayı gir");
//Taking the datas
sayı=input.nextInt();
//If they enter 0 the program will finish
max=sayı;
while(sayı!=0){
if (sayı>max){
max=sayı;
}else if(sayı==max)
//This counts max values
count++;
System.out.println("sayı gir");
sayı=input.nextInt();
}
System.out.println("The largest number is "+ max+" and the occurrence count of the largest number is "+ count);
}
}
Hiç yorum yok:
Yorum Gönder