0

Hi, recently i started taking lessons on c programming and my first assignment was to make programm which would name all the perfect multiperfect or superperfect numbers within a set (whose limits will be given as #define constants) and their percentage. Anyway apart from any logic errors (which i would be very glad if someone pointed out!!) i'm facing some compilation difficuties.

Specifically the code is

```
#include <stdio.h>
#define MAXM 6
#define MAXNUM 400000
main()
{ int n, sum, i, k, m, totdis, totsup, totmul, total, totper;
totdis=0;
total=0;
totmul=0;
totper=0;
totsup=0;
for (n = 1 ; n <= MAXNUM ; n++){
for (m = 1 ; m <= MAXM ; m++){
for (i = 1 ; i <= n ; i++){
sum = 0;
if (n % i == 0){
sum = sum + i;
}
if (sum % n == 0){
k = sum / n;
totdis++;
if (m == 1){
if (k == 2){
printf("%d is a (%d - %d) - perfect number, that is a perfect number\n",n, m, k);
total++;
totper++;
totmul++;
}
else{
printf("%d is a (%d - %d) - perfect number, that is a multiperfect number\n",n, m, k);
total++;
totmul++;
}
else if (m == 2 && k == 2){
printf("%d is a (%d - %d) - perfect number, that is a superperfect number\n",n, m, k);
total++;
totsup++;
}
else{
printf("%d is a (%d - %d) - perfect number\n",n, m, k);
total++;
}
}
}
}
}
}
printf("\nFound %d distinct (m-k)-perfect numbers (%10.10f % of %d) in %d occurencies \nFound %d perfect numbers \nFound %d multiperfect numbers (including perfect numbers)\nFound %d superperfect numbers \n",totdis, ((float) totdis / (float) MAXNUM) * 100, n, total, totper, totmul, totsup);
}
```

and the compiler errors are

37 syntax error before "else"

52 syntax error before string constant

i'm using DevC++ for Windows Vista

If anyone could help i would really appreciate an advice, i'm still a newbie!