#include <stdio.h>
// Algo:
// 1.input row column
// 2.elements one line input
// 3.show
int main(){
int r,c;
printf("Enter the rows and columns: ");
scanf("%d %d",&r,&c);
int n= r*c;
int matrix[r][c];
printf("Enter the %d elements below:\n",n);
printf("");
// Input elements
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
scanf("%d",&matrix[i][j]);
}
}
printf("Your %dX%d matrix is given below:\n",r,c);
// Display of matrix
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
printf("%d\t",matrix[i][j]);
}
printf("\n");
}
return 0;
}
//Program by: TEJAS
 |
Output |
Comments
Post a Comment