1: #include<stdio.h>
2: #include<conio.h>
3: #include<stdlib.h>
4: void main()
5: {
6: int x[10][10],y[10][10],xr,xc,yr,yc,i,j,equal=1;
7: printf("Matrix X:\n\n");
8: printf("Number of rows: ");
9: scanf("%d",&xr);
10: printf("\nNumber of clomuns: ");
11: scanf("%d",&xc);
12: for(i=0;i<xr;i++)
13: {
14: for(j=0;j<xc;j++)
15: {
16: printf("\nEnter the element x[%d][%d]",i,j);
17: scanf("%d",&x[i][j]);
18: }
19: }
20: printf("Matrix Y\n\n");
21: printf("Number of rows: ");
22: scanf("%d",&yr);
23: printf("\nNumber of columns: ");
24: scanf("%d",&yc);
25: for(i=0;i<yr;i++)
26: {
27: for(j=0;j<yc;j++)
28: {
29: printf("\nEnter the element y[%d][%d]",i,j);
30: scanf("%d",&y[i][j]);
31: }
32: }
33: if(xr!=yr||xc!=yc)
34: {
35: printf("\nMatrices cant be campare No of rows or columns are diffrent:\n");
36: getch();
37: exit(1);
38: }
39: else
40: {
41: for(i=0;i<xr;i++)
42: for(j=0;j<xc;j++)
43: if(x[i][j]!=y[i][j])
44: {
45: equal=0;
46: break;
47: }
48: if(equal)
49: printf("\nMatrices are identical");
50: else
51: printf("\nmatrice are not identical");
52: }
53: getch();
54: }
No comments:
Post a Comment