#include <stdio.h>
#include <stdlib.h>
int main()
{
int rows, cols, i, j;
printf("Enter number of rows and columns: ");
scanf("%d %d", &rows, &cols);
int **arr = (int **)malloc(rows * sizeof(int *));
for (i = 0; i < rows; i++)
{
arr[i] = (int *)malloc(cols * sizeof(int));
}
for (i = 0; i < rows; i++)
{
for (j = 0; j < cols; j++)
{
arr[i][j] = i * j;
}
}
for (i = 0; i < rows; i++)
{
for (j = 0; j < cols; j++)
{
printf("%d ", arr[i][j]);
}
printf("\n");
}
for (i = 0; i < rows; i++)
{
free(arr[i]);
}
free(arr);
return 0;
}