Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Merab Gurabanidze
Added: Jan 31, 2021 9:45 PM
Views: 4
Tags: no tags
  1. /* Program: Random number generator
  2.  * Written by: Chaitanya from beginnersbook.com
  3.  * Input: None
  4.  * Output:Random number between o and 200*/
  5. import java.util.*;
  6. class GenerateRandomNumber {
  7.    public static void main(String[] args) {
  8.       int counter;
  9.       Random rnum = new Random();
  10.       /* Below code would generate 5 random numbers
  11.        * between 0 and 200.
  12.        */
  13.       System.out.println("Random Numbers:");
  14.       System.out.println("***************");
  15.       for (counter = 1; counter <= 5; counter++) {
  16.          System.out.println(rnum.nextInt(200));
  17.       }
  18.    }
  19. }
  20.  
  21.