-->

WAP to input values for matrix of order 2x2 and display that.

//WAP to input values for matrix of order 2x2 and display that.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics[100][100];
int i,j;
int total_row,total_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[i][j]);
        }
}
 printf("the matrix is\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           printf("%d",matrics[i][j]);
        }
      printf(\n");
}
getch();
}
------------------------------------------
or
-----------------------------------
/WAP to input values for matrix of order 2x2 and display that.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics[2][2];
int i,j;
printf("enter elements of matrix\n");
for(i=0;i<2;i++)
{
  for(j=0;j<2;j++)
       {
           scanf("%d",&matrics[i][j]);
        }
}
 printf("the matrix is\n");
for(i=0;i<2;i++)
{
  for(j=0;j<2;j++)
       {
           printf("%d",matrics[i][j]);
        }
      printf(\n");
}
getch();
}

No comments:

Post a Comment