SHARE
TWEET

Giải BTVN Tin

anhkiet2507 Sep 8th, 2018 (edited) 12,078 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // De bai: Viet chuong trinh in ra tong, tich ,hieu, thuong cua 2 so a; b duoc nhap vao.
  2. // Khai bao thu vien
  3. #include <iostream>
  4. using namespace std;
  5. // Than chuong trinh
  6. int main()
  7. {
  8.     // Khai bao bien
  9.     float a{ 0 };
  10.     float b{ 0 };
  11.     float tong{ 0 };
  12.     float hieu{ 0 };
  13.     float tich{ 0 };
  14.     float thuong{ 0 };
  15.     // Nhap 2 so a,b
  16.     cout << "Nhap so a: "; // In ra man hinh thong bao nhap so a
  17.     cin >> a; // Luu ket qua vua nhap vao so a
  18.     cout << "Nhap so b: "; // In ra man hinh thong bao nhap so b
  19.     cin >> b; // Luu ket qua vua nhap vao so b
  20.     // Tinh toan tong, hieu, tich, thuong
  21.     tong = a + b;
  22.     hieu = a - b;
  23.     tich = a * b;
  24.     thuong = a / b;
  25.     // In ra man hinh tong hieu tich thuong
  26.     cout << "Tong hai so a va b la: " << tong << endl;
  27.     cout << "Hieu hai so a va b la: " << hieu << endl;
  28.     cout << "Tich hai so a va b la: " << tich << endl;
  29.     cout << "Thuong hai so a va b la: " << thuong << endl;
  30.     system("pause"); // Tam dung chuong trinh de doc ket qua
  31.     return 0;
  32. }
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