I've made this program as a school homework. It's for solving the "ax˛+bx+c=d" equation:
I may be doing some new ones (to compile it use the DEV c++ free-to-use software)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);};};
What I would like to do is making gaia bots out of it, but I don't know how! xD
Results 1 to 1 of 1
Thread: [C]Some beginner programms
- 21 Nov. 2010 04:55pm #1
[C]Some beginner programms
Last edited by ~Shieru No Tamashi~; 21 Nov. 2010 at 04:57pm.