Ajutor va rog,ajutati sa aflu rezolvarea si va rog explicati!!! Dau coroana
Răspunsuri la întrebare
Program f;
uses crt;
var a,b,c,d,x1,x2:real;
begin
write('introdu a=');readln(a);
write('introdu b=');readln(b);
write('introdu c=');readln(c);
d:=b*b-4*a*c;
if d>0 then
begin
x1:=(-b+sqrt(d))/2*a;
x2:=(-b-sqrt(d))/2*a;
Writeln('X1=',x1);
Writeln('X2=',x2);
end
else
Writeln('nu are radacina!!!');
Readkey; sau readln;
end.
aici
****
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
float a,b,c,x1,x2,d;
cin>>a>>b>>c;
d=b*b-4*a*c;
if(d<0)
cout<<"Nu are solutii reale";
else
if(d==0)
{
x1=(-b)/(2*a);
cout<<"Radacina dubla "<<fixed<<setprecision(2)<<x1;
}
else
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
cout<<fixed<<setprecision(2)<<x1<<" "<<x2;
}
return 0;
}
if d=0 then
begin
x1:=b*2*a
end;