Hey all, this is a problem on project euler #6. I did all of this code myself. With the for() loop comment removed the two printf() functions are resulting in wrong calculations (wrong). With the for() commented out the printf is resulting in the correct calculation for sum*sum (3025). also, i know to work the problem correctly I am going to need to set const int limit to 101; Here's problem on project euler
Code:
#include <stdio.h>


int main (void)
{
	int j, k;
	int i;
	const int limit = 11;	
	int squares_sum;
	int sum;


	/*
	for (j = 1; j < limit; j++)
	{
		// 1^2 + 2^2 + ... +10^2 = 385
		squares_sum = squares_sum += j*j;
	}


	printf("%d\n", squares_sum);
	*/


	while (i < limit) // let i itierate limit times then print sum
	{
		// 1+2+3+4+5+6+7+8+9+10
		sum = sum += i;	
		i++; // loop while loop limit times
	}


	printf("%d", sum*sum); // sum^2


	printf("\n");


	return 0;
}