SHARE
TWEET

average ][ Dev-Point

a guest Nov 5th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class Avrgg{
  3.  
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner sc = new Scanner(System.in);
  7.        
  8.         double[] nums = new double[5];
  9.         int i = 0;
  10.         double summ = 0;
  11.         while(i<5) {
  12.             System.out.print("Enter num "+i+" > " );
  13.             double x = sc.nextDouble();
  14.             nums[i] = x;
  15.             summ += x;
  16.            
  17.             i++;
  18.         }
  19.         for(int o = 0 ; o<5;o++) {
  20.             System.out.print(nums[o]+ " " );
  21.            
  22.            
  23.         }
  24.         System.out.println("][ average is : "+summ/5);
  25.     }
  26.  
  27. }
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