Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class gf{
- public static void main(String [] args)
- {
- int s,i;
- Scanner w=new Scanner(System.in);
- System.out.println("enter the size");
- s=w.nextInt();
- int n[]=new int[s];
- System.out.println("enter the elements");
- for(i=0;i<s;i++)
- {
- n[i]=w.nextInt();
- }
- System.out.println("those elements are");
- for(i=0;i<s;i++)
- {
- System.out.print(n[i]+" ");
- }
- System.out.println();
- int max=n[0];
- for(i=0;i<s-1;i++)
- {
- if(max<n[i+1])
- {
- max=n[i+1];
- }
- }
- System.out.println("maximum number is"+max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement