Program To Print 2X2 matrix
Output:
Enter the values in matrix
88
99
44
55
MATRIX REPRESENTATION
[ 88 99]
[ 44 55]
Code:
#include<stdio.h>
int main()
{
int arr[10][10]; //size of matrx
int i,j;
printf("\n Enter the values in matrix \n");
for(i=0;i<2;i++) //size can be increased as per user req
{
for(j=0;j<2;j++)
{
scanf("%d",&arr[i][j]);
}
}
for(i=0;i<2;i++)
{
printf("[");
for(j=0;j<2;j++)
{
printf(" %d",arr[i][j]);
}
printf("]");
printf("\n");
}
}
No comments :
Post a Comment