Accept & display matrix

C program to accept & display matrix element :

code

#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2];
int i,j;
clrscr();
printf(“Enter matrix element:”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(“\nEnter %d row & %d column :”,i,j);
scanf(“%d”,&a[i][j]);
}
}
printf(“\nEntered matrix :”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(“%d\t”,a[i][j]);

}

printf(“\n”);
}

getch();

}

 


output

Enter 0 row & 0 column :2

Enter 0 row & 1 column :3

Enter 1 row & 0  column :4

Enter 1 row & 1 column :5

Entered matrix :

2         3

4         5

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s