MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / perfectnumber

Function perfectnumber

CPP/questions/perfectnumber.cpp:4–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int perfectnumber(int n)
5{
6 int sum=0;
7 for (int i = 1; i < n; i++)
8 {
9 if (n % i == 0)
10 sum += i;
11 }
12 return sum;
13}
14
15int main()
16{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected