[C]Some beginner programms
I've made this program as a school homework. It's for solving the "ax˛+bx+c=d" equation:
Code:
float a,b,c,d,delta,x,y;
printf("Enter a value of a:");
scanf("%f",&a);
printf("Enter a value of b:");
scanf("%f",&b);
printf("Enter a value of c:");
scanf("%f",&c);
printf("Enter a value of d:");
scanf("%f",&d);
if(a==0)
{if(b==0) {if(c-d==0){printf("S=R");} else{printf("S=l'ensemble vide");};}
else {x=(d-c)/b;printf("The solution is:%f",x);};}
else {delta=b*b-4*a*(c-d);
if(delta<0) {printf("No solutions in R");};
if(delta==0) {x=-b/(2*a);printf("The solution is:%f",x);};
if(0<delta) {x=(-b-sqrt(delta))/(2*a);y=(-b+sqrt(delta))/(2*a);
printf("The two solutions are:%f",x);printf("and%f",y);};};
I may be doing some new ones (to compile it use the DEV c++ free-to-use software)
What I would like to do is making gaia bots out of it, but I don't know how! xD