View difference between Paste ID: QXtqC944 and es7KywdS
SHOW: | | - or go back to the newest paste.
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
}