Created
September 29, 2023 09:48
-
-
Save Dynesshely/84aa4fd35e0607f95ae8503e388cdeb4 to your computer and use it in GitHub Desktop.
Calculate the square of the 3x3 two-norm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int matrix_A[3][3] = {0}, sum = 0; | |
for (int i = 0; i < 3; ++ i) | |
for (int j = 0; j < 3; ++ j) | |
scanf("%d", &matrix_A[i][j]); | |
for (int j = 0; j < 3; ++j) | |
for (int i = 0; i < 3; ++i) | |
sum += matrix_A[i][j] * matrix_A[i][j]; | |
printf("%d\n", sum); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment