Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Lesson 9 Coding Activity Question 2
- *
- * Write the code to print a random integer from -20 to 20 inclusive using Math.random().
- *
- */
- import java.util.Scanner;
- import java.lang.Math;
- class Lesson_9_Activity_Two {
- public static void main(String[] args) {
- System.out.println((int)(Math.random() * 41 +- 20));
- }
- }
Add Comment
Please, Sign In to add comment