Im having problems with this code compiling:
Code:
#include <stdio.h>
int main(void)
{
int i = 0, n = 0, sum = 0;
printf("\n%s", "Enter an integer. \n");
scanf("%d", &i);
for (i > 0)
{
n = (2 * i);
for (i = 1; i <= n; ++i)
sum += i;
printf("sum = %d\n\n", sum);
}
/* for (i < 0)
{
n = (2 * i)
for (i = 1; i <= n; ++i)
sum += i;
printf("sum = %d\n\n", sum););
}
*/
return 0;
}
The errors are:
v1.c: In function 'main':
v1.c:15: error: parse error before ')' token
v1.c: At top level:
v1.c:33: error: parse error before 'return'
line 15 is the line with "for (i > 0)". I commented out the second major for loop to simplify troubleshooting.
What boneheaded thing did I do to get these parse errors?
Any help appreciated,
crazychile