City Suvidha...your one stop Search

C Programs

Go Back to List

Program to display a matrix.

 


#include<stdio.h>
#include<conio.h>

void main()
{
int a[3][2],b[3][2],i,j;
clrscr();
printf("enter value for a matrix: ");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
scanf("%d",&a[i][j]);
}
printf("enter value for b matrix: ");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
scanf("%d",&b[i][j]);
}
printf("\na matrix is\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf(" %d ",a[i][j]);
}
printf("\n");
}

printf("\nb matrix is\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
printf(" %d ",b[i][j]);
}
printf("\n");
}
getch();
}



 

Output:


enter value for a matrix: 7
8
9
4
5
6
enter value for b matrix: 3
2
1
4
5
6
a matrix is

7   8
9   4
5   6

b matrix is

3   2
1   4
5   6


 

If any of you want to submit your programs and contribute to site please mail us at:

citysuvidha@gmail.com

  Click here to have a look at  List of programs

You can download all the programs in a zip file also. For this you have to do one thing. Just register at the citysuvidha forum  and start any thread of any topic.  Once you start the thread and put your request, admin will automatically send you the desired zip file.