Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MatrixMul_shortxshort
//gcc 5.4.0 #include <stdio.h> short a[2][2], b[2][2]; int c[2][2]; int main(void) { int i, j, k=8; int sum; for (i=0;i<2; i++) { for (j=0;j<2;j++){ a[i][j] = i+j+1; } } for (i=0;i<2; i++) { for (j=0;j<2;j++){ b[i][j] = (i+j+1)*k; } } for (i=0;i<2;i++){ for (j=0; j<2; j++){ for (k=0;k<2;k++){ sum = sum + a[i][k] * b[k][j]; } c[i][j] = sum; sum=0; } } printf("Matrix A:\n"); for (i=0;i<2; i++) { for (j=0;j<2;j++){ printf("%d\t",a[i][j]); } printf("\n"); } printf("Matrix B:\n"); for (i=0;i<2; i++) { for (j=0;j<2;j++){ printf("%d\t",b[i][j]); } printf("\n"); } printf("\nAxB:\n"); for (i=0;i<2; i++) { for (j=0;j<2;j++){ printf("%d\t",c[i][j]); } printf("\n"); } return 0; }
run
|
edit
|
history
|
help
0
kushagra siingh_19BCE0665
C/Assembly
summing long int
Example of scanf and basic integer manipulation - with function call
json formatter
a1
-Shello.c
Project 5 v0.1
Done I think
THIS one uwu