Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package array;
- import java.util.Scanner;
- /**
- *
- * @author cse
- */
- public class Array {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int a[]= new int[5];
- Scanner sc= new Scanner(System.in);
- for (int i=0;i<=4;i++)
- a[i]=sc.nextInt();
- int pos=0;
- int max= a[0];
- for (int i=1;i<=4;++i){
- if (max<a[i])
- max= a[i];
- pos= i;
- }
- System.out.println("Max: "+max);
- System.out.println(pos);
- }
- }
Add Comment
Please, Sign In to add comment