I can't find the error and also C2182 error: illegal else without matching if.

#include <stdio.h>

int main (void)
	int count=0;		//counter
	int hours;			//hours
	char choice;		//users choice for continuing
	float total=0;		//total charge

	//print display
	printf ("%-15s %-10s %-10s","Customer","Hours","Total Charge");

	//assinging customer number


	//ask for # of hours
	printf("Please enter # of hours:\n");
	scanf ("%d",&hours);

	//calculating total parking charge
	if (hours<3) && (hours>0)
		if (hours>=10) && (hours<=24)
			total = 10;
			if (hours > 3) && (hours < 19)
				total = (hours-3)*.5 + 2;
				if (hours > 24)
					printf ("Invalid Entry...Try Again");
		//need to repeat if entry is incorrect

	//print display
	printf ("%10d %20d %15fl", count, hours, total);


return 0;

Ya, there is syntax error as stated in the above post...Also i want to add that even if there is only one expression corresponding to an 'if' or 'else', try using braces, this eliminates the possiblity of any ambiguity or error in future and code becomes managable...


Edited 3 Years Ago by Reverend Jim: Fixed formatting

This question has already been answered. Start a new discussion instead.