Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- double a,b,c,delta,x1,x2;
- cout<<"podaj wyznaczniki a, b i c:"<<endl;
- cin>>a>>b>>c;
- if (a!=0) {
- delta=(b*b)-(4*a*c);
- if (delta!=0) {
- x1=(-b-sqrt(delta))/(2*a);
- x2=(-b+sqrt(delta))/(2*a);
- } else {
- x1=(-b)/(2*a);
- x2=0;
- }
- } else {
- x1=(-c)/b;
- x2=0;
- }
- if (x2!=0) {
- cout<<"x wynosi"<<x1<<" lub "<<x2<<endl;
- } else {
- cout<<"to nie jest rΓ³wnanie kwadratowe, x wynosi "<<x1<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement