Hello,
Plz help me wth pseudocode of the above mentioned and also determing whether a number is a divisor of another number. If you are not sure abt the pseudocode u can give me c# code il try and convert it.
thnks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jun 14, 2011, 6:16 PM
Avuya MxoliPosted Jun 15, 2011, 4:16 AM
Avuya MxoliPosted Jun 14, 2011, 3:05 PM
I have something like for perfect number:
function IsPerfect(integer:n)
{
integer sum =0;
integer j;
FOR j goes from 1 to (n/2)
IF n MOD j EQUALS 0
sum = sum + j;
END IF
END FOR
IF sum EQUALS n
WRITE("perfect number");
ELSE
WRITE("not a perfect number")
END FUNCTION
}
VulpesPosted Jun 14, 2011, 2:37 PM
All of these use a straightforward 'brute force' approach rather than some of the 'clever' methods which exist for generating these numbers more quickly.