Perfect numbers: Difference between revisions

Content deleted Content added
m →‎{{header|C}}: removed dep. from gcc (__builtin_)
Line 61: Line 61:


=={{header|C}}==
=={{header|C}}==
{{trans|D}}
Based on the D version, for GCC:

<lang c>
#include "stdio.h"
<lang c>#include "stdio.h"
#include "math.h"
#include "math.h"


Line 72: Line 72:


for (i = 2; i < max; i++)
for (i = 2; i < max; i++)
if (__builtin_expect((n % i) == 0, 1)) {
if ( (n % i) == 0 ) {
tot += i;
tot += i;
int q = n / i;
int q = n / i;