PROBLEM SOLVING THROUGH PROGRAMMING IN C.
By Prof. ANUPAM BASU
WEEK 7:PROGRAM 3:
WEEK 7:PROGRAM 3:
Write a C program to find subtraction of two matrices i.e. matrix_A - matrix_B=matrix_C.
If the given martix are
2 3 5 and 1 5 2 Then the output will be 1 -2 3
4 5 6 2 3 4 2 2 2
6 5 7 3 3 4 3 2 3
The elements of the output matrix are separated by one blank space
for(i=0; i<row; i++) { for(j=0; j<col; j++) { matrix_C[i][j]=matrix_A[i][j]-matrix_B[i][j]; } } for(i=0; i<row; i++) { for(j=0; j<col; j++) { printf("%d ", matrix_C[i][j]); } printf("\n"); } return 0; }
WEEK 7:PROGRAM 4:
Write a C program to print lower triangle of a square matrix.
For example the output of a given matrix
2 3 4 will be 2 0 0
5 6 7 5 6 0
4 5 6 4 5 6
for(i = 0; i < r; i++)
{
for(j = 0; j < r; j++)
{
if(i >= j)
{
printf("%d ", matrix[i][j]);
}
else
{
printf("0 ");
}
}
printf("\n");
}
return 0;
}
}
Week-7 :Program-05
<<CLICK HERE FOR WEEK 7 :PROGRAM -05>>
<<CLICK HERE FOR WEEK 7 :PROGRAM-04>> FOLLOW OUR WEBSITE FROM THE BUTTON PROVIDED TO THE BOTTOM OF PAGE TO GET SOON ANSWERS OF PROGRAMS.
Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100% correct solutions.
No comments:
Post a Comment
If you have any problems related to solutions or any concept please let me know.