Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
B_141128_MatricesSuma
//Title of this code #include <stdio.h> #include <stdlib.h> #include <time.h> #define _F 7 #define _C 4 int main(void) { long a[_F][_C]; long b[_F][_C]; long s[_F][_C]; short f, c; for(srand(time(NULL)) , f = 0 ; f < _F ; f++) { for(c = 0 ; c < _C ; c++) { a[f][c] = rand() % 10; } } for(f = 0 ; f < _F ; f++) { for(c = 0 ; c < _C ; c++) { b[f][c] = rand() % 10; } } for(f = 0 ; f < _F ; f++) { for(c = 0 ; c < _C ; c++) { s[f][c] = a[f][c] + b[f][c]; } } for(f = 0 ; f < _F ; f++) { for(c = 0 ; c < _C ; c++) { printf("%3ld", a[f][c]); } printf(" "); for(c = 0 ; c < _C ; c++) { printf("%3ld", b[f][c]); } printf(" "); for(c = 0 ; c < _C ; c++) { printf("%4ld", s[f][c]); } printf("\n"); } return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Array Struct, Call-By-Reference, Malloc, Free, Init, Destroy ... Example
variable arguments 2
Conditional logic.c
pointer example 3
Thread and Mutex Code
AVANCE PREGUNTA 10 DE CADENAS
faster posting list using skip pointers
Calculating longs v0.5 finish b next lab
Good
Multiple If statements v1
Please log in to post a comment.