-->

WAP to get sub-matrix of a matrix of order 'mxn'.

//WAP to get sub-matrix of a matrix of order 'mxn'.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100];
int i,j,sum=0;
int total_row,total_col;
int sub_row,sub_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics_1[i][j]);
         
        }
}
printf("now enter total rows and columns to be \n");
printf("enter total number of rows(m)\n");
scanf("'%d",&sub_row);
printf("'enter total columns(n)\n");;
scanf("%d",&sub__col);
for(i=0;i<sub_row;i++)
{
  for(j=0;j<sub_col;j++)
       {
           printf("%d",matrics_1[i][j]);
         
        }

     printf("\n");
}     
getch();
}



No comments:

Post a Comment