problem with logic in for loop

#include<conio.h>
#include<stdio.h>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void main()
{
	int i=0,j;
	for(i=2;i<=5;i++)
	{
		printf("\ni am starting");
		for(j=i+3;j<i*3+2;j++);
		{
			printf("   %d",j);
		}
		printf("\nhello");
	}

	getch();
}



why after this line 7
for(j=i+3;j<i*3+2;j++);
value of j=8 but it has to be 5 i think :P, please help me with this logic
for(j=i+3;j<i*3+2;j++);
is the same as
1
2
for(j=i+3;j<i*3+2;j++)
{  }


Remove the semi-colon on line 7


Also, void main() isn't C++ and conio.h is non-standard and you're learning wrong C++ from twenty years ago.
Last edited on
well you have given me the answer (problem is because of semicolon)
thank u
Topic archived. No new replies allowed.