Advertisement
Guest User

MAx

a guest
Sep 22nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     // int-&&&& for 5 = 3
  8.     int n;
  9.     cout << "Enter n="; cin >> n;
  10.     int k = 0;
  11.     while (n > 0)
  12.     {
  13.         if (n % 10 == 5) k++;
  14.         n /= 10;
  15.     }
  16.     if (k == 3) cout << "Answer: True" << endl;
  17.     else cout << "Answer: False" << endl;
  18.     // double-aaa.&&&& for 1 = 9
  19.     double m;
  20.     cout << "Enter m="; cin >> m;
  21.     int m_ = m;
  22.     bool p = 0;
  23.     for (int i = 0; i < 4; i++)
  24.     {
  25.         m -= m_;  
  26.         m *= 10;
  27.         if (m >= 9)
  28.         {
  29.             p = 1;
  30.             break;
  31.         }
  32.         m_ = m;
  33.     }
  34.     if (p == 1) cout << "Answer: True" << endl;
  35.     else cout << "Answer: False" << endl;
  36.     // logic var
  37.     bool a;
  38.     bool b;
  39.     cout << "Enter a="; cin >> a;
  40.     cout << "Enter b="; cin >> b;
  41.     bool c;
  42.     if ((a == true) && (b == false)) c = true;
  43.     else c = false;
  44.     cout << "Answer:";
  45.     if (c == true) cout << "True" << endl;
  46.     else cout << "False" << endl;
  47.     system("pause");
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement