Error message: "error C2181:1> illegal else without matching if

2>fatal error C1075: end of file found before the left brace '{' at 'c:\documents and settings\tjeo1\my documents\visual studio 2008\projects\new\newc\exercise.cpp(3)' was matched

#include <stdio.h>
int main (void)
{
	int c;

	printf("letter=");
	c = getchar ( );

	if (('0' <= c && c <= '9') || ('A' <= && c <='F') || ('a' <= c && c <='f')){
		printf ("It is a hexadecimal\n");
	else {
		printf (" It is not a hexadecimal\n");
		}
	
	return 0;
	}

Your missing a '}' in your if statement. Check right before the else.

Thanks for the reply. I have added } but still got the problem.

Error message :
1.error C2059: syntax error : '&&'
2.error C2143: syntax error : missing ';' before '{'
3. error C2181: illegal else without matching if

#include <stdio.h>
int main (void)
{
int c;

printf("letter=");
c = getchar ( );

if (('0' <= c && c <= '9') || ('A' <= && c <='F') || ('a' <= c && c <='f')){
	printf ("It is a hexadecimal\n");
}
else {
printf (" It is not a hexadecimal\n");
}

return 0;

}

Read ('A' <= && c <='F') over. Something's amiss.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.