Saturday, October 20, 2012

Java Exercise #29: Max Number & Count

This program is to find the largest number in an array and then count its occurrences.

Exercise: Write a program that reads 6 integers from the user, then find the largest of them and count its occurrences.


Enter the number: 3
Enter the number: 5
Enter the number: 2
Enter the number: 5
Enter the number: 5
Enter the number: 4

The array is 5 2 5 5 4 
The largest number is 5
The number of occurrence is 3



Download Code: Max and its Count

No comments:

Post a Comment