Відповідь:
#include <iostream>
using namespace std;
int main() {
int year;
cout << "Enter a year: ";
cin >> year;
if (year % 4 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
int grade;
cout << "Enter your grade: ";
cin >> grade;
if (grade >= 1 && grade <= 3) {
cout << "Initial level" << endl;
} else if (grade >= 4 && grade <= 6) {
cout << "Middle level" << endl;
} else if (grade >= 7 && grade <= 9) {
cout << "Sufficient level" << endl;
} else if (grade >= 10 && grade <= 12) {
cout << "High level" << endl;
cout << "Invalid grade" << endl;
int height, age;
cout << "Enter your height (in cm): ";
cin >> height;
cout << "Enter your age: ";
cin >> age;
int weight = height % 100;
if (age <= 25) {
weight -= 5;
} else if (age <= 45) {
weight = weight;
} else if (age <= 65) {
weight += 5;
weight += 10;
cout << "Your ideal weight is " << weight << " kg" << endl;
Пояснення:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Відповідь:
#include <iostream>
using namespace std;
int main() {
int year;
cout << "Enter a year: ";
cin >> year;
if (year % 4 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int grade;
cout << "Enter your grade: ";
cin >> grade;
if (grade >= 1 && grade <= 3) {
cout << "Initial level" << endl;
} else if (grade >= 4 && grade <= 6) {
cout << "Middle level" << endl;
} else if (grade >= 7 && grade <= 9) {
cout << "Sufficient level" << endl;
} else if (grade >= 10 && grade <= 12) {
cout << "High level" << endl;
} else {
cout << "Invalid grade" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int height, age;
cout << "Enter your height (in cm): ";
cin >> height;
cout << "Enter your age: ";
cin >> age;
int weight = height % 100;
if (age <= 25) {
weight -= 5;
} else if (age <= 45) {
weight = weight;
} else if (age <= 65) {
weight += 5;
} else {
weight += 10;
}
cout << "Your ideal weight is " << weight << " kg" << endl;
return 0;
}
Пояснення: