Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- int row, col;
- int size;
- int diagA, diagB;
- std::cout << "Enter height of the песочные часы ";
- std::cin >> size;
- for (row = 0; row < size; row++) {
- for (col = 0; col < size; col++) {
- diagA = row;
- diagB = size - row - 1;
- if (diagA <= diagB) {
- if (col >= diagA && col <= diagB)
- std::cout << "1 ";
- else
- std::cout << "0 ";
- } else {
- if (col >= diagB && col <= diagA)
- std::cout << "1 ";
- else
- std::cout << "0 ";
- }
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement