Advertisement
Monty374

Highest Gade

Nov 28th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package highest.grae;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class HighestGrae {
  6.  
  7. /**
  8. * @param args the command line arguments
  9. */
  10. public static void main(String[] args) {
  11. int[] grades;
  12. grades = new int[5];
  13. Scanner input = new Scanner(System.in);
  14. int grade = 0;
  15. int count = 0;
  16. int mark;
  17. int highestVal = 0;
  18. do {
  19. System.out.println("Enter grade ");
  20. grade = input.nextInt();
  21. grades[count] = grade;
  22. count += 1;
  23. }while (count < 5);
  24.  
  25. for (int i = 0; i < grades.length; i++) {
  26. int current = grades[i];
  27. if (current > highestVal) {
  28. highestVal = current;
  29. }
  30.  
  31. }
  32.  
  33. System.out.println("Highest grade: " + highestVal);
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement