1 solutions
-
0
C++ :
#include <iostream> using namespace std; int fn(int n) { int a=0; for (int i = 1; i <= n; i++) { if(n%i==0) a+=i; } return a; } int main() { int c; cin>>c; cout<<fn(c)<<endl; return 0; }Pascal :
var n,i,s:longint; begin readln(n); for i:=1 to n do if n mod i=0 then s:=s+i; writeln(s); end.
- 1
Information
- ID
- 17105
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By