Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- // вывести квартиры от 1 до 40
- for (int i = 0; i < 4; i++) {
- for (int g = 0; g < 5; g++) {
- for (int f = 1; f <= 2; f++) {
- cout << f + g * 2 + i * 10 << " ";
- }
- }
- }
- cout << endl;
- // определить этаж и подъезд квартиры по номеру
- int choice = 0;
- cout << "Введите номер квартиры: "; // от 1 до 40
- cin >> choice;
- for (int i = 0; i < 4; i++) {
- for (int g = 0; g < 5; g++) {
- for (int f = 1; f <= 2; f++) {
- if (f + g * 2 + i * 10 == choice)
- cout << "подъезд - " << i + 1 << ", этаж - " << g + 1 << endl;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment