diff --git a/Java/MostOccuringElement.java b/Java/MostOccuringElement.java new file mode 100644 index 0000000..0a39ce2 --- /dev/null +++ b/Java/MostOccuringElement.java @@ -0,0 +1,31 @@ +package com.company.milestone; + +import java.util.Scanner; + +public class Demo6 { +public static void main(String[]args) { + Scanner scanner = new Scanner(System.in); + int [] array = new int[10]; + for (int i=0;imaxcount) { + maxcount=count; + mostoccur=array[i]; + } + } + System.out.println("Most occured element is "+mostoccur+" and "+maxcount+" times it repeated."); + scanner.close(); + } + + }