Advertisement
1nikitas

Untitled

Mar 3rd, 2022
1,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. from random import randint
  2. n = 50
  3. sum = 0
  4. count = 0
  5. d = 0
  6. a = [randint(0,10000) for i in range(n)]
  7. max = 0
  8. min = 10001
  9.  
  10. for i in range(len(a)):
  11.     if a[i] % 2 == 0:
  12.         d += 1
  13.     if a[i] % 3 == 0:
  14.         d += 1
  15.     if a[i] % 5 == 0:
  16.         d += 1
  17.     if a[i] % 7 == 0:
  18.         d += 1
  19.     if d == 2:
  20.         count += 1
  21.         if a[i] > max:
  22.             max = a[i]
  23.         if a[i] < min:
  24.             min = a[i]
  25.     else:
  26.         d = 0
  27.        
  28. print("Количество:", count)
  29. sum = min + max
  30. print("Сумма минимального и максимального:", sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement