Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. class LargestNumber {
  2.     public static void main(String args[]) {
  3.         int[] a = new int[] { 20, 30, 50, 4, 71, 100};
  4.         int max = a[0];
  5.         for(int i = 1; i < a.length;i++) {
  6.             if(a[i] > max) {
  7.                 max = a[i];
  8.             }
  9.         }  
  10.         System.out.println("From The Array Element Largest Number is:" + max);
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement