Advertisement
apez1

Term 1: Lesson 34 - Coding Activity 3

Nov 28th, 2018
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Lesson_34_Activity_Three {
  5.    
  6.     static Scanner scanner = new Scanner(System.in);
  7.    
  8.     public static int findMax(int a[]) {
  9.         int biggest = 0;
  10.        
  11.         for(int i =0; i < a.length; i++) {
  12.             if(a[i] > biggest) {
  13.                 biggest = a[i];
  14.             }          
  15.         }
  16.        
  17.         return biggest;
  18.        
  19.     }
  20.  
  21.    
  22.  
  23.     public static void main(String[] args) {   
  24.    
  25.     int a[] = {3,6,1};
  26.    
  27.     int x = findMax(a);
  28.    
  29.     System.out.println(x);
  30.    
  31.    
  32.     }
  33.    
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement