[C++] Giải phương trình bậc 2 : ax^2+bx+c
[C++] Giải phương trình bậc 2 : $ax^2+bx+c$
Lời giải (Code C++)
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double a,b,c,delta;
cout<<"Nhap so a: ";cin>>a;
cout<<"Nhap so b: ";cin>>b;
cout<<"Nhap so c: ";cin>>c;
delta=b*b-4*a*c;
if ((delta<0)||(a==0))cout<<"Phuong trinh vo nghiem";
else
if (delta==0) cout<<"Phuong trinh co nghiem kep x= "<<-b/(2*a);
else cout <<"Phuong trinh co 2 nghiem phan biet x1= "<<(-b+sqrt(delta))/(2*a)<<" va x2= "<< (-b-sqrt(delta))/(2*a);
return 0;
}
tioquaquad-e Terrance Shaw https://wakelet.com/wake/Rf_w23QC76ZH3unJQPHFP
ReplyDeleterohavpingper
0haugoas-bu-Newark Vida Terrell Nulled
ReplyDeleteSpeedify
VMware Workstation
lodardestfib