Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- float a,b,c,delta,x1,x2;
- do {
- cout<<"a=";cin>>a;
- } while (!a);//
- cout<<"b=";cin>>b;
- cout<<"c=";cin>>c;
- delta=(b*b-4*a*c);
- if (delta>=0) {
- delta=sqrt(delta);
- x1=(-b+delta)/(2*a);//*/
- x2=(-b-delta)/(2*a);
- cout<<"x1="<<x1<<endl;
- cout<<"x2="<<x2<<endl;
- }
- else
- cout<<"ecuatia nu are solutii";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement