Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
2
using namespace std;
3
4
int 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
15
int main()
16
{
Callers
1
main
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected