Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- int i,j,n,m;
- printf("Escolha o tamanho da matriz quadrada... \n");
- scanf("%d",&n);
- int mat[n][n];
- srand(time(NULL));
- printf("Escolha um valor limite para gerar valores aleatórios...\n");
- scanf("%d",&m);
- for(i=0;i<n;i++){
- for(j=0;j<n;j++){
- mat[i][j]=rand()%m;
- }
- }
- for(i=0;i<n;i++){
- for(j=0;j<n;j++){
- printf("%d ",mat[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment