#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> int printRandoms(int lower, int upper, int count) { int i; for (i = 0; i < count; i++) { int num = (rand() % (upper - lower + 1)) + lower; return num; } } int main() { int row,col, i, j,V; static int cnt=0; printf("\n Enter no. of rows ....\n"); scanf("%d",&row); printf("\n Enter no. of cols ....\n"); scanf("%d",&col); printf("\n Enter range ....\n"); scanf("%d",&V); int arr[row][col]; for(int j=0;j<row;j++){ for(int i=0;i<col;i++) { if(col%2==0){ if(i <= (col/2)-1) { arr[i][j] = printRandoms((-1)* V, V, 1); } else { arr[i][j] = (-1) * (arr[abs(i - (col-1))][j]); } } else { if(i <= (col/2)) { arr[i][j] = printRandoms((-1)* V, V, 1); } else { arr[i][j] = (-1) * (arr[abs(i - (col))][j]); } } }} printf("\n printing the elements ....\n"); for(i=0;i<row;i++) { printf("\n"); for (j=0;j<col;j++) { printf("%d\t",arr[i][j]); } } }