c program to find perfect number using function