#include <stdbool.h>
#include <stdio.h>
#define TAM 5
bool posicao_numero(int matriz[TAM][TAM], int num, int *linha_num, int *coluna_num){
int c, c2;
for (c=0; c<TAM; c++){
for (c2=0; c2<TAM; c2++){
if (matriz[c][c2] == num){
*linha_num = c;
*coluna_num = c2;
return true;
}
}
}
return false;
}
int main(){
int matriz[TAM][TAM], c, c2, num, p1, p2;
for (c=0; c<TAM; c++){
for (c2=0; c2<TAM; c2++){
scanf("%d", &matriz
[c
][c2
]); }
}
printf("Que numero deseja encontrar? ");
if (posicao_numero(matriz, num, &p1, &p2)){
} else {
printf("Numero nao encontrado. "); }
return 0;
}
I2luY2x1ZGUgPHN0ZGJvb2wuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgVEFNIDUKCmJvb2wgcG9zaWNhb19udW1lcm8oaW50IG1hdHJpeltUQU1dW1RBTV0sIGludCBudW0sIGludCAqbGluaGFfbnVtLCBpbnQgKmNvbHVuYV9udW0pewogICAgaW50IGMsIGMyOwogICAgZm9yIChjPTA7IGM8VEFNOyBjKyspewogICAgICAgIGZvciAoYzI9MDsgYzI8VEFNOyBjMisrKXsKICAgICAgICAgICAgaWYgKG1hdHJpeltjXVtjMl0gPT0gbnVtKXsKICAgICAgICAgICAgICAgICpsaW5oYV9udW0gPSBjOwogICAgICAgICAgICAgICAgKmNvbHVuYV9udW0gPSBjMjsKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIGZhbHNlOwp9CgppbnQgbWFpbigpewogICAgaW50IG1hdHJpeltUQU1dW1RBTV0sIGMsIGMyLCBudW0sIHAxLCBwMjsKICAgIGZvciAoYz0wOyBjPFRBTTsgYysrKXsKICAgICAgICBmb3IgKGMyPTA7IGMyPFRBTTsgYzIrKyl7CiAgICAgICAgICAgIHNjYW5mKCIlZCIsICZtYXRyaXpbY11bYzJdKTsKICAgICAgICB9CiAgICB9CgogICAgcHJpbnRmKCJRdWUgbnVtZXJvIGRlc2VqYSBlbmNvbnRyYXI/ICIpOwogICAgc2NhbmYoIiVkIiwgJm51bSk7CgogICAgaWYgKHBvc2ljYW9fbnVtZXJvKG1hdHJpeiwgbnVtLCAmcDEsICZwMikpewogICAgICAgIHByaW50ZigiWyVkXVslZF0iLCBwMSwgcDIpOwogICAgfSBlbHNlIHsKICAgICAgICBwcmludGYoIk51bWVybyBuYW8gZW5jb250cmFkby4gIik7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K