Write program to generate random numbers in different range and display: (c) A number in range [0, 10) (d) A number in range [0, 1000] (e) A number in range [-99, 99] (f) A double number in range [1000.0, 9999.0)
In Java Please
import java.util.Random; public class RandomNumbers { public static void main(String[] args) { Random random = new Random(); int c = random.nextInt(10); int d = random.nextInt(1001); int e = random.nextInt(199) - 99; double f = 1000 + random.nextDouble() * 8999; System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); } }
Get Answers For Free
Most questions answered within 1 hours.