Tuesday 4 April 2017

Algorithm to Check a Number is Perfect or Not


Step 1 : Start
Step 2 : Read Number
Step 3 :  i = 1 ,Sum = 0
Step 4 : if  i <= Number / 2 then go to Step 5  
             else go to Step 8
Step 5 : if  Number % i = 0 then go to Step 6
             else go to Step 7
Step 6 : Sum = Sum + i
Step 7 : i = i + 1 , then  go to Step 4
Step 8 : if  Sum = Number then go to Step 9
             else go to Step 10
Step 9 : print "Number is Perfect" ,go to Step 11
Step 10 : print "Number is not Perfect" ,go to Step 11
Step 11 : Stop 

No comments:

Post a Comment

How to Invert an SVG image using CSS ?

You can invert your svg easily by using following css code svg { -webkit-filter: invert(100%); /* safari 6.0 - 9.0 */ filter...