Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Дз от 13.11.2024г.
- 1)
- #include <iostream>
- using namespace std;
- int main() {
- int number;
- cout << "Введите число от 1 до 100: ";
- cin >> number;
- if (number >= 1 && number <= 100) {
- if (number > 50) {
- cout << "Число больше 50." << endl;
- } else if (number < 50) {
- cout << "Число меньше 50." << endl;
- } else {
- cout << "Число равно 50." << endl;
- }
- } else {
- cout << "Число находится вне диапазона от 1 до 100." << endl;
- }
- return 0;
- }
- 2)
- #include <iostream>
- using namespace std;
- int main() {
- double num1, num2;
- cout << "Введите первое число: ";
- cin >> num1;
- cout << "Введите второе число: ";
- cin >> num2;
- string result = (num1 > num2) ? "Первое число больше второго" :
- (num1 < num2) ? "Первое число меньше второго" :
- "Числа равны";
- cout << result << endl;
- return 0;
- }
- 3)
- #include <iostream>
- using namespace std;
- int main() {
- int age;
- cout << "Введите свой возраст: ";
- cin >> age;
- if (age >= 18) {
- cout << "Вы совершеннолетний" << endl;
- } else {
- cout << "Вы несовершеннолетний" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement