Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

how to write a c++ program which given an integer n, classifies it as "perfect", "abundant" or "deficient. a number is perfect if the sum of its divisor (excluding the number) is equal to the number eg. 6. a number is abundant is if the sum of its divisor (excluding the number is greater than the number eg 12?

OpenStudy (anonymous):

Here's a function for perfect numbers: int perfect(int number) { int factor=1, sum=0; while(number>1){ if(number%factor==0){ sum+=factor; } factor++; if(factor>=number)break; } if(sum==number)return true; else return false; }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!