Write a statement to generate a random number between 10 and 50( both inclusive)
Answers
Answered by
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
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