Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- void main(){
- int l, c, i, j, matriz[6][6];
- srand(time(NULL));
- int comparador = 0;
- //preenche a matriz com 0.
- for(l=0; l<6; l++){
- for(c=0; c<6; c++){
- matriz[l][c] = 0;
- }
- }
- for(l=0; l<6; l++){
- for(c=0; c<6; c++){
- if(comparador == 0){
- matriz[l][c] = rand() % 18;
- comparador = 1;
- for(i=0; i<l; i++){
- for(j=0; j<c; j++){
- if(matriz[l][c] = matriz[i][j]){
- comparador = 0;
- }
- }
- }
- }
- printf(" %i ", matriz[l][c]);
- }
- puts("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment