Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
#include<math.h>
main() {
float x1,x2,a,b,c,d;
printf("a=");
scanf("%f" , &a);
printf("b=");
scanf("%f" , %b);
printf("c=");
scanf("%f" , &c);
d=(b*b-4*a*c);
if (a==0)
	if(b!=0){
		x1=-c/b;
		printf(one root solution);
		}
	else
		printf(no solution);
else if (a!=0){
 
     if (d>0){
     x1=(-b-sqrt(d)/2*a);
     x2=(-b+sqrt(d)/2*a);
     printf("root is%f\n", x1);
     printf("root is%f\n", x2);
     }
     else if (d==0)
     x1=-b/2*a;
     x2=x1;
     printf("only one root%f\n", x1);
 
     else (d<0){
     printf("no roots%f\n");
 
     }
aider moi a corriger mes fautes SVP
merci

L'exercice est:
écrivez un programme qui trouve les solutions de l'équation ax²+bx+c=0
considerer tous les cas possibles, utiliser les instruction if...else if...else if...else