Largest among all in Java
Compile and Run the following code with Command-Prompt Or download Notepad++.
For Compilation javac Sample.java
For Execution java Sample
import java.util.Scanner; class Sample { public static void main(String[] args) { int a[]; int max,i,n; Scanner sc = new Scanner(System.in); System.out.println("Enter the number: "); n = sc.nextInt(); a = new int[n]; System.out.println("The Largeest of all is "+max); } static int maximum(int[] a,int n) { int i; int m = 0; for(i = 0;i<n;i++) { if(a[i]>m) { m = a[i]; } } return m; } }