Hello...just started learning C and i'm trying to write a program that solves quadratic equations...but every time i compile and run it and enter the 3 variables it crashes. I kept on looking but didn't find anything wrong with it...help? :P
#include <stdio.h>
main(){
int a,b,c;
float x1,x2;
printf("Please enter a b c: \n");
scanf("%d %d %d",a,b,c);
if (a == 1){
x1= (b/2) + sqrt(pow(b/2,2)-c);
x2= (b/2) - sqrt(pow(b/2,2)-c);
} else {
x1= (b+ sqrt(pow(b,2) - 4*a*c))/(2*a);
x2= (b- sqrt(pow(b,2) - 4*a*c))/(2*a);
}
printf("The solutions are: \n%f ja %f",x1,x2);
getch();
}