
write a program that reads 10 numbers fin the largest number and count the occurrence of the largest number from declared array assume you assigned 4,6,3,2,5,6,6,1 and 6.

import java.util.*;
class FindLargest{
public static void main(String[] args){
int max = Integer.MIN_VALUE;
System.out.println("Enter 10 numbers:");
Scanner input=new Scanner(System.in);
int array[]=new int[10];
int count=0;
for(int i=0;i<array.length;i++){
array[i]=input.nextInt();
if (array[i] > max) {
max = array[i];
}
}
for(int i=0;i<array.length;i++){
if(array[i]==max){
count++;
}
}
System.out.println("Largest Number is "+max+" which occurs "+count+" times");
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.