1: #include<stdio.h> 2: #include<conio.h>3: void main()
4: {5: int i,j,r,c;
6: int x[10][10];
7: printf("Enter the number of rows: ");
8: scanf("%d",&r);
9: printf("Enter the number of columns: ");
10: scanf("%d",&c);
11: for(i=0;i<r;i++)
12: {13: for(j=0;j<c;j++)
14: { 15: x[i][j]=2*i+3*j; 16: } 17: }18: printf("The matrix is given below\n\n");
19: for(i=0;i<r;i++)
20: {21: for(j=0;j<c;j++)
22: {23: printf("%5d",x[i][j]);
24: }25: printf("\n");
26: } 27: getch(); 28: }
No comments:
Post a Comment