Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Random;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- Random random = new Random();
- int n,sum =0;
- n = in.nextInt();
- int[] a = new int[n];
- for(int i =0;i<n;i++)
- {
- a[i] = random.nextInt()%100;
- System.out.println("number:"+a[i]);
- sum = sum + a[i];
- System.out.println("sum="+sum);
- }
- System.out.println("result="+sum);
- System.out.println("sr ar:"+sum/n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement