Advertisement
FernandoADS

Untitled

Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4.  
  5. void verifica(int *x, int a[][10]){
  6. int i, j;
  7. for(i=0; i<10; i++){
  8. for(j=0; j<10; j++){
  9. if(a[i][j]==*x){
  10. *x = 1;
  11. }
  12. else if(a[i][j]!=*x){
  13. *x = 0;
  14. }
  15. }
  16. }
  17. }
  18.  
  19. void Imprimirmatriz(int x[][10]){
  20. int i, j;
  21. for(i=0; i<10; i++){
  22. printf("\n");
  23. for(j=0; j<10; j++){
  24. printf("%d ", x[i][j]);
  25. }
  26. }
  27. }
  28.  
  29. int sorteio(int x[][10]){
  30. int i, j;
  31. for(i=0; i<10; i++){
  32. for(j=0; j<10; j++){
  33. x[i][j]=rand()%10;
  34. }
  35. }
  36. return x[i][j];
  37. }
  38.  
  39. int main(){
  40. int matriz[10][10]={};
  41. int x=0;
  42. srand(time(NULL));
  43. sorteio(matriz);
  44. Imprimirmatriz(matriz);
  45. printf("\n\n");
  46. scanf("%d", &x);
  47. verifica(&x, *matriz);
  48. printf("\n%d\n", x);
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement