Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. #include <progbase.h>
  6. #include <progbase/console.h>
  7. #include <time.h>
  8. int main()
  9. {
  10. int M = 0;
  11. int N = 0;
  12. int H = 0;
  13. int L = 0;
  14. srand(time(0));
  15.  
  16. int dim2[M][N];
  17.  
  18. do
  19. {
  20. printf("N = ");
  21. scanf("%d", &N);
  22. printf("M = ");
  23. scanf("%d", &M);
  24. } while (M < 0 || N < 0); //розмырнысть матриці
  25.  
  26. while (1)
  27. {
  28. do
  29. {
  30.  
  31. printf("Введіть максимальне значення масиву\n");
  32. scanf("%d", &H);
  33. printf("Введіть мінімальне значення масиву\n");
  34. scanf("%d", &L);
  35.  
  36. } while (H - L < 0);
  37.  
  38.  
  39. for (int n = 0; n < N; n++)
  40. {
  41. for (int m = 0; m < M; m++)
  42. {
  43. dim2[n][m] = rand() % (H - L + 1) + L;
  44. }//писвоєння рандомних цілих чисел
  45. }
  46.  
  47. for (int n = 0; n < N; n++)
  48. {
  49. for (int m = 0; m < M; m++)
  50. {
  51. printf("%d ", dim2[n][m]);
  52. }
  53. printf("\n"); //малювання матриці
  54. }
  55.  
  56.  
  57.  
  58. }
  59.  
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement