Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
644 B
0
Indexable
Never
#include <iostream>
#include <iomanip>

int main() 
{
    const int size = 5;

    std::cout << "    ";
    for (int i = 1; i <= size; ++i) 
    {
        std::cout << std::setw(4) << i;
    }
    std::cout << std::endl;

    std::cout << "    ";
    for (int i = 1; i <= size; ++i) 
    {
        std::cout << "----";
    }
    std::cout << std::endl;

    for (int i = 1; i <= size; ++i) 
    {
        std::cout << std::setw(2) << i << " |";

        for (int j = 1; j <= size; ++j) 
        {
            std::cout << std::setw(4) << i * j;
        }
        std::cout << std::endl;
    }

    return 0;
}
Leave a Comment