Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Recorrido matriz bidimensional y busqueda valor
//clang 3.7.0 #include <stdio.h> #include <stdlib.h> #define MAX 20 int main(void) { int v[3][4]; // = {{2,3,4,5},{1,2,3,4},{7,6,7,7}}; int i,j,valor = 8; int encontrado=0; srand(time(NULL)); for (i=0; i<3; i++) for (j=0; j<4; j++) v[i][j]=rand() % MAX; for (i=0; i<3; i++) { for (j=0; j<4; j++) printf("%d\t",v[i][j]); printf("\n"); } for (i=0; i<3; i++) for (j=0; j<4; j++) if(v[i][j]==valor) encontrado++; if (encontrado) printf("\nLo encontré %d %s!!!", encontrado, (encontrado==1?"vez":"veces")); else printf("\nNo lo encontré :(("); return 0; }
run
|
edit
|
history
|
help
0
Vectores: mayor, menor, media
Bucles: Rombo asimetrico
VKI_Mihalyk_3_2
Graph Depth First Search
MyBlockQuicksort
Triples bucles anidados
definice funkce
CV09-2
lab7
Hello World C