Напишите программу, которая в последовательности натуральных чисел определяет количество чисел, кратных 4, но не кратных 7. Программа получает на вход количество чисел в последовательности, а затем сами числа. Программа должна вывести одно число: количество чисел, кратных 4, но не кратных 7, если такие числа есть и "NO", если таких чисел нет.
To solve this problem, you will need to use a loop to iterate through each number in the provided sequence. Within the loop, you can use conditional statements to check if the current number is both divisible by 4 and not divisible by 7. If this condition is met, you can increment a counter variable to keep track of the number of qualifying numbers. After the loop finishes, you can check the value of the counter and if it is greater than 0, print the counter's value as the number of qualifying numbers. Otherwise, print "NO" to indicate that there are no numbers that meet the criteria.Example code:
counter = 0
sequenceLength = int(input("Enter the number of numbers in the sequence: "))
for i in range(sequenceLength):
number = int(input("Enter a number in the sequence: "))
if number % 4 == 0 and number % 7 != 0:
counter += 1
if counter > 0:
print("The number of qualifying numbers is: ", counter)
else:
print("NO")