Advertisement
cd62131

Random100

Jul 8th, 2014
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.34 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class Random100 {
  4.   public static void main(String[] args) {
  5.     int[] a = new int[100];
  6.     Random r = new Random();
  7.     for (int i = 0; i < a.length; i++)
  8.       a[i] = r.nextInt(10);
  9.     int count5 = 0;
  10.     for (int e : a)
  11.       if (e == 5)
  12.         count5++;
  13.     System.out.println(count5);
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement