#include <stdio.

h>

int main()
{
int a[25][25];
int m;
int n;

scanf("%d %d", &n, &m);
int p;

p = 1;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
{
if(p % 3 == 0)
p = p +2;
a[i][j] = p;
p = p + 2;
}

for(int i = n; i >= 1; i--)
{
for(int j = m; j >= 1; j--)
printf("%d ", a[i][j]);
printf("\n");
}
return 0;
}

Related Interests