Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class arrayExp {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner key = new Scanner(System.in);
- int [] num = new int [5];
- int i;
- int sum=0;
- double avg;
- for(i=0;i<5;i++)
- {
- System.out.println("Enter any number:");
- num[i]=key.nextInt();
- sum = sum+num[i];
- }
- System.out.println("Your numbers are:");
- for(i=0;i<5;i++)
- {
- System.out.print(num[i]+"\n");
- }
- avg=sum/5.0;
- System.out.println("The total are "+sum);
- System.out.println("The average are "+avg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement