Hello there!
The following is an implementation of the street numbers problem.
My output stops at the fifth line! probably because of bad memory management or the size of the integers. I tried bigger types like long long but the problem persists.
Code:#include <stdlib.h> #include <stdio.h> int main(int args, char* argv[]){ int sum1, sum2; int count = 0; int max = 8; int temp = 0; while(count < 10){ temp = (max * (max + 1) / 2); for (int house = 1 ; house <=max ; house++){ sum1 = house * (house - 1) / 2; sum2 =temp - house - sum1; if (sum1 == sum2){ printf("%d\t%d\n",house,max); count++; } } max++; } printf("\t\t\tEnd of Program\n\t\t\t"); system("PAUSE"); }