Professional Documents
Culture Documents
Final Practical of Focp
Final Practical of Focp
ALGORITHM:
STEP 1: START
STEP 2: DECLARE MATRIX a[i][j]; and MATRIX b[i][j]; and
MATRIX c[i][j]; where i is the number of rows and j is number of
columns.
STEP 3: Read a[ ][ ] and b[ ][ ]
STEP 4: Declare variable i=0, j=0.
STEP 5: Repeat until i<3.
STEP 6: Repeat until j<3.
STEP 7: c[i][j] = a[i][j] + b[i][j].
STEP 8: j++, i++.
STEP 9: C is the required matrix after the addition of two matrixes a
and b.
STEP 10: STOP.
CODE:
CODE:
#include <stdio.h>
int main()
{
int a[3][3];
int i ,j ;
}
}
printf("2D array element a:\n" );
for(i=0 ; i<3 ; i++ ){
for(j =0; j<3 ; j++){
printf("%d " , a[i][j]);
if(j==2){
printf("\n");
}
}
}
int b[3][3];
}
}
printf("2D array element a:\n" );
for(i=0 ; i<3 ; i++ ){
for(j =0; j<3 ; j++){
printf("%d " , b[i][j]);
if(j==2){
printf("\n");
}
}
} int c[3][3] ;
for(i=0 ; i<3 ; i++ ){
for(j =0; j<3 ; j++){
c[i][j]= a[i][j] + b[i][j];
printf("%d + %d =%d" , a[i][j], b[i][j] , c[i][j]);
}
}
OUTPUT:
LEARNING OUTCOMES:
1. I learned about the use of arrays in addition to the matrix.
2. I learned 2D arrays and learn how to implement them.
3. I learned how to put an array of elements in its matrix form.
4. I learned how to make a program using mathematics concepts.
5. I learned complex codes of c programming.