ahmed0saber

Max and Min of 2 random numbers in Java

Nov 7th, 2020
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class MyClass {
  2.   public static void main(String[] args) {
  3.    int random = (int)(Math.random()*101);
  4.    int random2 = (int)(Math.random()*101);
  5.    System.out.println(random);
  6.    System.out.println(random2);
  7.    System.out.println("Max and Min are "+(Math.max(random,random2))+" and "+(Math.min(random,random2)));
  8.   }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment