Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <math.h>
- using namespace std;
- int main()
- {
- int a, b, c, d;
- cout << "Wyznaczanie pierwiastkow rownania a(x^2)+bx+c=0" << endl;
- cout << "Podaj a: ";
- cin >> a;
- cout << "Podaj b: ";
- cin >> b;
- cout << "Podaj c: ";
- cin >> c;
- (d=(sqrt((b*b)-(4*a*c))));
- if (d<0)
- {
- cout << "Wyrazenie nie ma pierwiastkow.";
- }
- else if (d==0)
- {
- cout << "Pierwiastek wyrazenia: " << (-(b/(2*a)));
- }
- else if (d>0)
- {
- cout << "Pierwiastek wyrazenia: " << ((-b-d)/2*a);
- cout << "Pierwiastek wyrazenia: " << ((-b+d)/2*a);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement