Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Random;
  4. import java.util.Scanner;
  5.  
  6. public class Main {
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner in = new Scanner(System.in);
  10.         Random random = new Random();
  11.  
  12.         int n,sum =0;
  13.         n = in.nextInt();
  14.         int[] a = new int[n];
  15.  
  16.         for(int i =0;i<n;i++)
  17.         {
  18.             a[i] = random.nextInt()%100;
  19.             System.out.println("number:"+a[i]);
  20.             sum = sum + a[i];
  21.             System.out.println("sum="+sum);
  22.         }
  23.         System.out.println("result="+sum);
  24.         System.out.println("sr ar:"+sum/n);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement