Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Задача 1)
- #include <iostream>
- using namespace std;
- int main()
- {
- string answear;
- do {
- cout << "Have you watched Justice League?[Y; N]";
- cin >> answear;
- }
- while (answear != "Y" || answear != "N");
- if (answear == "Y") {
- cout << "Don't SPOIL IT!";
- } else {
- cout << "Let's watch it together!";
- }
- return 0;
- }
- ========================================================
- Задача 2)
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, sum, count;
- count = 0;
- cout << "Enter n: ";
- cin >> n;
- do {
- sum += count;
- count++;
- }
- while (count <= n);
- cout << "The result is: " << sum;
- return 0;
- }
- ========================================================
- Задача 3)
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, counter, count_of_possitive;
- count_of_possitive = 0;
- counter = 0;
- cout << "Enter n: ";
- cin >> n;
- do {
- if (counter % 2 == 0 && counter > 0){
- count_of_possitive++;
- cout << "Number " << counter << " is possitive!\n";
- }
- counter++;
- }
- while (counter < n);
- cout << "The possitive numbers are: " << count_of_possitive;
- return 0;
- }
- ========================================================
- Задача 4)
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int x, y, power = 1;
- cin >> x >> y;
- do {
- cout << power << " is a possitive power for a x\n";
- power++;
- } while (pow(x, power) < y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement