Check perfect number using PHP Code - Web Development

Check perfect number using PHP Code

This is interview question .How to check a entered number is a perfect number of not

Output of the code :

I have taken 13 so it will give this output

:-

Your enterded number is not a Perfect Number

How to print a traigle using PHP Code :- We can print stars traingle using for loop .

Now if you run this code in your browser then it will show this output


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

Now we will see another example

Now if you will run this code in your browser Output :-

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

Now another patter for star traingle

If you run this program in your broswer Output :

See more PHP Tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *