illegel if else

Why its giving error when am using if else.. with only if it working fine. error is illegal else without if.

[code]
void glist(int num[10])
{
cout<<"Number greater then 50 are:"<<endl;

for(int i=0; i<10; i++)
{
if(num[i]>50)
{
cout<<num[i]<<endl;

else
cout<<"Not found"<<endl;
}
}

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void glist(int num[10])
{
	cout<<"Number greater then 50 are:"<<endl;

	for(int i=0; i<10; i++)
	{
		if(num[i]>50)
		{
			cout<<num[i]<<endl;

			else // What if statement does this belong to?
			
			cout<<"Not found"<<endl;
		}
	}
} 
Topic archived. No new replies allowed.