There are a number of ways to generate random numbers in java, Write a java program with following specifications- 1. It
Posted: Thu May 26, 2022 9:42 am
There are a number of ways to generate random numbers in java, Write a java program with following specifications- 1. It should generate 4 random numbers in the range [1-99] 2. Sum of these random numbers should be less than 100 3. This sum should be divisible by 11 4. As you may not get it in one run, use sentinel value type do- while loop to achieve this. 5. Prints the number of iterations (times loop has to run) taken by program to print the result Sample run 1 First Number -16 Second Number -12 Third Number -20 Fourth Number -40 Sum 88 Target found after 8 Iterations. Sample run 2 First Number -10 Second Number 32 Third Number -41 Fourth Number 16 ‒‒‒‒‒‒ Sum - 99 Target found after 13 Iterations