I am a newbie to programming, i started with c programming as many people said it is a good idea to start with c or c++. Anyway, i was writing this code but i keep getting error on the last else. i looked everywhere i can't find the error. the message is not clear (or i don't understand what it means). can you look at this code and tell me what is wrong? thank you
Code:
#include <stdio.h>
#include <stdlib.h>
/*SIMPLE PROGRAM FOR FINDING REAL ROOTS OF THE EQUATION: ax2+bx+c=0*/
int main()
{
float a,b,c,x1,x;
printf("enter a, b, c separated by space\n");
scanf("%f%f%f",&a,&b,&c);
if (a==0&&b==0)
printf("No root");
else if(a==0)
printf("there is only one root %f",-c/b);
else if ((b*b-4*a*c)<0)
printf("No root");
else {
x1=-b+((b*b-4*a*c)/2)2*a;
x=-b-((b*b-4*a*c)/2)2*a;
printf(" X1 is %f, X is %f",x1,x);
}
getchar();
return 0;
}