SHARE
TWEET

train 2 (Bài 1)

ImoogiWild Oct 24th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main(){
  5.     int a;
  6.     int b;
  7.     int c;
  8.     int delta = (pow(b,2)- 4*a*c) ;
  9.     cout<<"phuong trinh ax^2+bx+c=0 , nhap vao a,b,c de bat dau giai"<< endl;
  10.     cout<<"a : "; cin>> a;
  11.     cout<<"b : "; cin>> b;
  12.     cout<<"c : "; cin>> c;
  13.     if (a==0)
  14.     {
  15.         cout<<"pt co nghiem la : "<< -b/c ;
  16.     }
  17.     else
  18.         {
  19.             if (delta < 0)
  20.             {
  21.                 cout<<"pt vo nghiem ! ";
  22.             }
  23.             else
  24.                 {
  25.                     if (delta = 0)
  26.                         {
  27.                             cout<<"phuong trinh co nghiem kep la : "<<-b/(2*a);
  28.                         }
  29.                     else
  30.                     {
  31.                         cout<<"pt co 2 nghiem phan biet la "<< (-b - sqrt(delta))/(2*a)<< " va "<<(-b + sqrt(delta))/(2*a);
  32.                     }
  33.                 }
  34.         }
  35.    
  36.        
  37.             return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top