Comparison operator problem

Hello,

In the below code when i == 0, else if condition evaluated true but i should be greater than 0. What's the problem?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 void SemiRectangle(int n)
{	
	int low = 0;
	int high = n - 1;
	int mid1 = (low + high) / 3;
	int mid2 = low + (2 * (low + high)/3);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if ((i == 0 || i == n - 1) && (j > mid1 && j <= mid2))
			{
				cout << "*";
			}
			else if ((j == 0 || j == n - 1) && (i > 0 || i < n - 1))
			{
				cout << "*";

			}
			else cout << " ";
		}
		cout << "\n";
	}
	}
What's the value of j when this happens?
Topic archived. No new replies allowed.