Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (25 sloc) 0.356 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include<stdio.h>
#include<math.h>

int divisors(int n)
{
  int i,c=0;
  for(i=2;i<sqrt(n);++i){
    if(!(n%i))
      ++c;
  }
  c = c<<1;
  if(i*i == n)
    ++c;
  return c+2;
}

int main()
{
  int i,n,d;
  d = 6;
  for(i=8;d<500;++i){
    n = (i*(i+1))>>1;
    if((n&1) == 0)
      d = divisors(n);
  }
  printf("Number = %d and Divisors = %d\n",n,d);
}
Something went wrong with that request. Please try again.