Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- // int-&&&& for 5 = 3
- int n;
- cout << "Enter n="; cin >> n;
- int k = 0;
- while (n > 0)
- {
- if (n % 10 == 5) k++;
- n /= 10;
- }
- if (k == 3) cout << "Answer: True" << endl;
- else cout << "Answer: False" << endl;
- // double-aaa.&&&& for 1 = 9
- double m;
- cout << "Enter m="; cin >> m;
- int m_ = m;
- bool p = 0;
- for (int i = 0; i < 4; i++)
- {
- m -= m_;
- m *= 10;
- if (m >= 9)
- {
- p = 1;
- break;
- }
- m_ = m;
- }
- if (p == 1) cout << "Answer: True" << endl;
- else cout << "Answer: False" << endl;
- // logic var
- bool a;
- bool b;
- cout << "Enter a="; cin >> a;
- cout << "Enter b="; cin >> b;
- bool c;
- if ((a == true) && (b == false)) c = true;
- else c = false;
- cout << "Answer:";
- if (c == true) cout << "True" << endl;
- else cout << "False" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement