StefanTobler

Lesson 9 Activity 2

Sep 12th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. /*
  2.  * Lesson 9 Coding Activity Question 2
  3.  *
  4.  * Write the code to print a random integer from -20 to 20 inclusive using Math.random().
  5.  *
  6. */
  7.  
  8. import java.util.Scanner;
  9. import java.lang.Math;
  10.  
  11. class Lesson_9_Activity_Two {
  12.     public static void main(String[] args) {
  13.      
  14.       System.out.println((int)(Math.random() * 41 +- 20));
  15.  
  16.     }
  17. }
Add Comment
Please, Sign In to add comment