Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

asdf

a guest Nov 21st, 2018 78 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. import java.util.*;
  2. public class arrayExp {
  3.  
  4.     public static void main(String[] args) {
  5.         // TODO Auto-generated method stub
  6.         Scanner key = new Scanner(System.in);
  7.         int [] num = new int [5];
  8.         int i;
  9.         int sum=0;
  10.         double avg;
  11.        
  12.         for(i=0;i<5;i++)
  13.         {
  14.             System.out.println("Enter any number:");
  15.             num[i]=key.nextInt();
  16.             sum = sum+num[i];
  17.         }
  18.        
  19.         System.out.println("Your numbers are:");
  20.         for(i=0;i<5;i++)
  21.         {
  22.             System.out.print(num[i]+"\n");
  23.         }
  24.         avg=sum/5.0;
  25.         System.out.println("The total are "+sum);
  26.         System.out.println("The average are "+avg);
  27.        
  28.     }
  29.  
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top