Skip to content

Instantly share code, notes, and snippets.

@Dynesshely
Created September 29, 2023 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dynesshely/84aa4fd35e0607f95ae8503e388cdeb4 to your computer and use it in GitHub Desktop.
Save Dynesshely/84aa4fd35e0607f95ae8503e388cdeb4 to your computer and use it in GitHub Desktop.
Calculate the square of the 3x3 two-norm
#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