Computer Science, asked by Rainbowgain, 2 months ago

Write a program to input a number and check whether it's divisible by 5 or not if it's then check whether it's a odd number or even number​

Answers

Answered by Equestriadash
10

The following cσdes have been written using Python.

n = int(input("Enter a number: "))

print()

if n%5 == 0:

   print("The number is divisible by 5.")

   if n%2 == 0:

       print("The number is even.")

   else:

       print("The number is odd.")

else:

   print("The number is not divisible by 5.")

The program involves the usage of conditional constructs, which is the 'if-else' clause. It's a conditional statement that helps test for specified conditions, where the results are based on Boolean [true/false] values. It normally follows a similar syntax:

if <test expression>:

     statement

else:

    statement

Similar questions