FACTORS OF A NUMBER

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

W.A.P TO FIND THE FACTORS OF A 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

<!DOCTYPE html>
<html><head><meta charset="utf-8"><title></title>
<script type="text/javascript">

// fACTOR 12 = 1,2,3,4,6, AND 12

function check() {
    var number= document.getElementById('n1').value;
    var ans="";
    for(var i=1; i<=number; i++)
    {
        if(number%i==0){
            ans = ans.concat(`${i} `);
        }
    }
    document.getElementById('ans').innerText=`Factor of ${number} are ${ans} `;
}


</script>
</head><body>
FACTOR GENERATOR
<br>
<input type="number" name="" id="n1"/>
<br>
<button onclick="check()">GENERATE</button>
<h2 id="ans" ></h2>

</body></html>

Online Compiler

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

PYTHON Program

 

Online Compiler: 

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

Comments

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES