Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. /*
  2. * Lesson 9 Coding Activity Question 1
  3. *
  4. * Write the code to print a random integer from 1 to 10 inclusive using Math.random().
  5. *
  6. */
  7.  
  8. import java.util.Scanner;
  9. import java.lang.Math;
  10.  
  11. class Lesson_9_Activity_One {
  12. public static void main(String[] args) {
  13.  
  14. int a;
  15. a = (int)(Math.random() * 20) - 20;
  16.  
  17. System.out.println(a);
  18.  
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement