Advertisement
aar6947

Untitled

Sep 11th, 2020
1,315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. public class School{
  2.  public static int getAverage(int[] marks){
  3.     double studentAverage = 0;
  4.     int arrayLength = marks.length;
  5.    
  6.     for(int i=0; i<marks.length; i++){
  7.       studentAverage += marks[i] / (arrayLength * 1.0);
  8.     }
  9.    
  10.     return (int) studentAverage;
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement