Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void varLength(){
- System.out.println(avg(25,75,100));
- }
- public static int avg(int...num) { // ... can put any amount of numbers in num
- int total=0;
- // (x : num) all of the values in the array num are put in x one at a time.
- for(int x:num)
- total+=x;
- return total/num.length;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement