int main() { long int a=1; long int b=0; while(1==1) //if the number we're currently testing has less than 500 divisors, test the next one { b=trng(a); //set b to the ath triangle number if(dvsr(b)>=500) break; a++; } printf("%ld",b); return 0; }