Back to Home & C
//Program to enter a matrix and print it
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[5][5],i,j,r,c;
printf("Enter row and column size\n");
scanf("%d%d",&r,&c);
printf("Enter elements of matrix\n");
for(i=0;i<r;i++)
{
for(j=0;i<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Matrix elements...\n");
for(i=0;i<r;i++)
{
for(j=0;i<c;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
getch();
}
-------------------------------------------------------------
Output ( May be some error in output)
Enter row and column size
2
2
Enter elements of matrix
34
65
78
98
Matrix elements...
34 65
78 98
(Will print in matrix format)
================================
Back to Home & C
//Program to enter a matrix and print it
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[5][5],i,j,r,c;
printf("Enter row and column size\n");
scanf("%d%d",&r,&c);
printf("Enter elements of matrix\n");
for(i=0;i<r;i++)
{
for(j=0;i<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Matrix elements...\n");
for(i=0;i<r;i++)
{
for(j=0;i<c;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
getch();
}
-------------------------------------------------------------
Output ( May be some error in output)
Enter row and column size
2
2
Enter elements of matrix
34
65
78
98
Matrix elements...
34 65
78 98
(Will print in matrix format)
================================
Back to Home & C
No comments:
Post a Comment