#include #include #include #define NL 9 #define NC 17 int main(void) { srand(3); long t[NL][NC]; printf("%zu octets\n", sizeof(t)); printf("\n"); for (int l = 0; l < NL; l++) { for (int c = 0; c < NC; c++) { t[l][c] = rand() % 1000; } } for (int l = 0; l < NL; l++) { for (int c = 0; c < NC; c++) { printf("%4ld", t[l][c]); } printf("\n"); } printf("\n"); for (int l = 0; l < NL; l++) { long somme = 0; for (int c = 0; c < NC; c++) { somme += t[l][c]; } printf("%4d : %7ld\n", l, somme); } printf("\n"); int l = 0; int c = 0; bool zeroTrouve = false; do { if (t[l][c] == 0) { zeroTrouve = true; } else { c++; if (c == NC) { c = 0; l++; } } } while ((l < NL) && (!zeroTrouve)); if (zeroTrouve) { printf("Il y a un zero en position %d %d\n", l, c); } else { printf("Il n'y a pas de zero\n"); } return 0; }