Computer Science, asked by hiya2108, 6 months ago

Write a statement to generate a random number between 10 and 50( both inclusive)​

Answers

Answered by Oreki
1

Statement to generate random number between 10 and 50 -

> 10 + (int) (Math.random( ) * (50 - 10 + 1));

On the basis of the statement,

> x + (int) (Math.random( ) * (y - x + 1));

Answered by anindyaadhikari13
2

Question:-

  • Write a statement to generate a random number between 10 and 50.

Statement:-

The statement is:-

10+(int)Math.random(50-10+1)

Or,

10+(int)Math.random(41);

Similar questions