Rahh ben moi j´viens de finir un prog en Ada !
Mais c´qui m´enerve c´est que j´ai pas réussi la prise en charge des 0 ! Snif snif
with Ada.Text_Io;
use Ada.Text_Io;
with Ada.Integer_Text_Io;
use Ada.Integer_Text_Io;
with Ada.Float_Text_Io;
use Ada.Float_Text_Io;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure exo6 is
A,B,C:Integer;
D,X,X1,X2:Float;
begin
Put("Dans l´équation ax²+bx+c = 0, entrer A:");
Get(A);
Put("Entrer B:");
Get(B);
Put("Entrer C:");
Get(C);
D:=(Float(B)**2.0)-(4.0*Float(A)*Float(C));
if ( D>Float(0))
then
X1:=(-Float(B)-Sqrt(D))/(2.0*Float(A));
X2:=(-Float(B)+Sqrt(D))/(2.0*Float(A));
Put("X1:");Put(X1,1,1,0);
New_Line;
Put("X2:");Put(X2,1,1,0);
elsif ( D<Float(0))
then
Put("Pas de solution réelle.");
elsif ( D=Float(0))
then
X:=(-Float(B))/(2.0*Float(A));
Put("X:");Put(X,1,1,0);
end if;
end exo6;
Regardez ^^, si y´a des connaisseurs, dites moi pourquoi quand je mets A=0, B=0, C=0 il me sort un Naaaaaaaaan !
Vilaine Konsole ! 