22ADS108 Lecture Notes - Lecture 7: Scanf Format String, Transpose

6 views6 pages

Document Summary

2d-array (two dimensional array: write a program in c to add two 2d-array of size (3 3) and store result in 3rd array (matrix). #include int main() int a[3][3],b[3][3],c[3][3],i,j; printf("addition of a two matrix :\n"); printf("enter nine elements in the first matrix :\n"); for(i=0;i<3;i++) for(j=0;j<3;j++) printf("enter nine elements in the second matrix :\n"); for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&a[i][j]); scanf("%d",&b[i][j]); for(i=0;i<3;i++) for(j=0;j<3;j++) C[i][j]=a[i][j]+b[i][j]; printf("\n\naddition of two matrix: "); for(i=0;i<3;i++) printf("\n"); for(j=0;j<3;j++) printf("%d ",c[i][j]): write a program in c to multiply two matrix of size (2 3) and display the result in third matrix. #include int main() int a[2][3],b[2][3],c[2][3],i,j; printf("enter six elements in the first matrix :\n"); for(i=0;i<2;i++) for(j=0;j<3;j++) printf("enter six elements in the second matrix :\n"); for(i=0;i<2;i++) for(j=0;j<3;j++) for(i=0;i<2;i++) for(j=0;j<3;j++) C[i][j]=a[i][j]*b[i][j]; printf("\n\nthe multiplication of two matrix is : "); for(i=0;i<2;i++) printf("\n"); for(j=0;j<3;j++) scanf("%d",&b[i][j]); printf("%d ",c[i][j]): write a program to enter elements for 2d- matrix using keyboard and print the.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions