Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int a,b,c;
  7.     cin >> a >> b >> c;
  8.     int d;
  9.     d= b*b - 4 * a * c;
  10.     if(d > 0){
  11.        cout << "x1 = "<< -b -sqrt(d) / 2*a;
  12.        cout << "x2 = " << -b + sqrt(d) / 2 * a;
  13.     }else if(d == 0){
  14.        cout << "x0 ="<< -b / 2*a;
  15.     } else{
  16.        cout << "brak miejsc zerowych";
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement