Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- int main()
- {
- int i,j,lines,columns,begin,end,matrix[10][15];
- srand(time(NULL));
- printf("Entre com a quantidade de linhas e colunas para a matriz, respectivamente :\n");
- scanf("%d %d",&lines,&columns);
- printf("Entre com o intervalo numerico para o sorteio (menor e maior, respectivamente :)\n");
- scanf("%d %d",&begin,&end);
- for (i = 0; i < lines; i++) {
- for (j = 0; j < columns; j++)
- matrix[i][j] = rand() % begin + (end - begin + 1);
- }
- for (i = 0; i < lines; i++) {
- for (j = 0; j < columns; j++) {
- printf("%d ",matrix[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment