Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[10];
  8. int c[10];
  9. cout << "Массив A: ";
  10. for (int i = 0; i < 10; i++) {
  11. a[i] = rand() % 10 - 5;
  12. cout << a[i] << ' ';
  13. }
  14.  
  15. cout << "\nМассив Ak: ";
  16. for (int i = 0; i < 10; i++) {
  17. c[i] = rand() % 10 - 5;
  18. cout << c[i] << ' ';
  19. }
  20.  
  21. cout << "\nЭлементы в промежутке от 1 до 10: ";
  22. int b = -1;
  23. for (int i = 0; i < 10; i++) {
  24. if (c[i] > a[0] && c[i] < a[9]) {
  25. cout << c[i] << ' ';
  26. b = a[i];
  27. }
  28. }
  29. if (b == -1) cout << 0;
  30. cout << '\n';
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement