Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <stdlib.h>
  2.  
  3. int main()
  4. {
  5. int N = 50;
  6. int i, j, m;
  7. int mass[N], temp = 0;
  8. setlocale(0, "rus");
  9.  
  10. printf("Введите количество элементов: ");
  11. scanf("%d", &N);
  12.  
  13. if (N > 50) {
  14. printf("Ограничение 50\n");
  15. return 1;
  16. }
  17.  
  18. printf("Элементы: \n");
  19. for (i = 0; i < N; i++) {
  20. mass[i] = rand() % 99;
  21. printf("%d ", mass[i]);
  22. }
  23. printf("\n");
  24.  
  25. for (i = 0; i < N - 1; ++i) {
  26. for (j = 0; j < N - 1; ++j) {
  27. if (mass[j + 1] > mass[j]) {
  28. temp = mass[j + 1];
  29. mass[j + 1] = mass[j];
  30. mass[j] = temp;
  31. }
  32. }
  33. }
  34.  
  35. for (i = 0; i < N; i++)
  36. printf("%d ", mass[i]);
  37.  
  38. if(mass[i]%=7 == 1 || 2 || 3)
  39. printf("\n%d ", mass[i]);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement