Numbers that are divisible by 3.

x = int(input(“How many numbers do you need to check? “))
d3 = 0
nd3 = 0
for i in range(x):
    number = int(input(“Enter number: “))
    check = number % 3

    if check == 0:
        print(f”{number} is divisible by 3.”)
        d3 += 1

    else:
        print(f”{number} is not divisible by 3.”)
        nd3 += 1

print(f”You entered {d3} number(s) that are divisible by 3.”)

print(f”You entered {nd3} number(s) that are not divisible by 3.”)

Home Page


Posted

in

by

Tags:

Comments

One response to “Numbers that are divisible by 3.”

  1. not mr wilmoth Avatar
    not mr wilmoth

    Great code

Leave a Reply

Your email address will not be published. Required fields are marked *