im writing this program for an intro to c class, I was wondering if anyone knows whats wrong with this code? it says theres an error with the first else, if i take the curly brackets out it says theres a problem with all 3 else's. Thanks.

#include <stdio.h>

int main ()

{
	int sd1, sd2, sd3;
	
	
	printf("Please enter the first length: \n");
	scanf("%d%*c", &sd1);
	
	printf("Please enter the second length: \n");
	scanf("%d%*c", &sd2);
	
	printf("Please enter the third length: \n");
	scanf("%d%*c", &sd3);
	
	
	if (sd1+sd2<sd3||sd2+sd3<sd1||sd1+sd3<sd2);
		printf ("This is not a triangle");
	else
	
	{
		if (sd1==sd2&&sd2==sd3);
			printf ("Equilateral Triangle");
		else
			
			if (sd1==sd2||sd2==sd3||sd1==sd3);
				printf ("Isoselecs Triangle");
			else
				printf ("Scalene Triangle");
	}
	
	return (0);
}
Salem commented: Nice - code tags on your first post :) +20

> if (sd1+sd2<sd3||sd2+sd3<sd1||sd1+sd3<sd2);
Watch the birdie!

commented: quick and painless +7

> if (sd1+sd2<sd3||sd2+sd3<sd1||sd1+sd3<sd2);
Watch the birdie!

i dont understand the semi colon was already there? what do you mean by watch the birdie?

ok i understand thank you

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.