[Solved] filling a matrix with equations results in c++


You need to print the x and y variables at first and then increase them.

#include <iostream>

int main(int argc, char** argv)
{
    int t[2][25];
    int x = 0;
    int y = 0;
    for (int l = 5; l > 0; l--)
    {
        for (int col = 5; col >=1; col--)
        {
            t[0][x] = 500 / l;
            t[1][y] = 500 / col;
    
            std::cout << t[0][x] << '\t';
            std::cout << t[1][y] << '\t';
            std::cout << '\n';
            x++;
            y++;
        }
        
    }
    return 0;
}

0

solved filling a matrix with equations results in c++