Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int a, b, c, y, x1, x2;
- int delta;
- cout << "Podaj pierwsza liczbe" << endl;
- cin >> a;
- cout << "Podaj druga liczbe" << endl;
- cin >> b;
- cout << "Podaj trzecia liczbe" << endl;
- cin >> c;
- delta = b * b - (4 * a * c);
- if (delta < 0)
- {
- cout << "Brak wyniku delta rowna zero" << endl;
- }
- if (delta == 0)
- {
- x1 = -b / (2 * a);
- cout << "Wynik wynosi " << x1 << endl;
- }
- if (delta > 0)
- {
- delta = sqrt(delta);
- x1 = (-b - delta )/( 2 * a);
- x2 = (-b + delta) / (2 * a);
- cout << "Wynik wynosi x_1= " << x1 << " a x_2= " << x2 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement