Aliquot sum | C # program for aliquot sum ; Function to calculate sum of all proper divisors ; Driver Code
using System ; class GFG { static int aliquotSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i < n ; i ++ ) if ( n % i == 0 ) sum += i ; return sum ; } public static void Main ( ) { int n = 12 ; Console . WriteLine ( aliquotSum ( n ) ) ; } }