GENERATE RANDOM NUMBER

 

************************************************************************ 

W.A.P TO GENERATE A RANDOM NUMBER

************************************************************************  

JAVA Program







   



  
Online compiler

Output:


************************************************************************ 

C Program



Online Compiler 

 

************************************************************************ 

C++ Program

Online Compiler

************************************************************************ 

C# Program


 
 
Output:

************************************************************************ 

PHP Program


Online Compiler

Php is a server side scripting language.

************************************************************************ 

JAVASCRIPT Program

<script type="text/javascript">
// Math.random() returns a random floating point number 0 to 1
// Math.random() * (highestNumber - lowestNumber ) + lowestNumber  

var x = Math.random();
console.log("Before Calculations "+ x);
x=x* (100 -1) +1;
console.log("After calculations "+x);

// Math.floor(Math.random() * (highestNumber - lowestNumber )) + lowestNumber)
let a =  Math.floor(Math.random() * (100 - 1) + 1);
console.log("Floor calculation "+ a);

</script>

Online Compiler

************************************************************************ 

PYTHON Program

 

Online Compiler: 

************************************************************************  
















Comments

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES