Все эти задачи похожи между собой, но различны некоторыми цифрами.
Дано натуральное число. Определить, будет ли это число:
7 задача) чётным, кратным 4.
8 задача) нечётным, кратным 5.
9 задача) нечётным, кратным 7.
10 задача) чётным, кратным 10.
Задача №7
import random a = random.randint(0,999) print(a) if a % 2 == 0: print("the number is even") else: print("the number is odd") if a % 4 == 0: print("the number multiple of 4") else: print("the number is not a multiple of 4")
Результат исполнения кода
Решение на Codngground
Задача №8
import random a = random.randint(0,999) print(a) if a % 2 == 0: print("the number is even") else: print("the number is odd") if a % 5 == 0: print("the number multiple of 5") else: print("the number is not a multiple of 5")
Результат исполнения кода
Решение на Codngground
Задача №9
import random a = random.randint(0,999) print(a) if a % 2 == 0: print("the number is even") else: print("the number is odd") if a % 7 == 0: print("the number multiple of 7") else: print("the number is not a multiple of 7")
Результат исполнения кода
Решение на Codngground
Задача №10
import random a = random.randint(0,999) print(a) if a % 2 == 0: print("the number is even") else: print("the number is odd") if a % 10 == 0: print("the number multiple of 10") else: print("the number is not a multiple of 10")
Результат исполнения кода
Решение на Codngground