Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Divisibility Check

A concise Python program that determines whether a user-provided integer is divisible by 5.

Technologies Used

  • Python 3
  • Built-in input() function
  • Built-in print() function
  • Modulo operator (%)
  • Ternary conditional expression

Features

  • 🔢 Accepts an integer input from the user
  • ✅ Checks divisibility by 5 using the modulo operator
  • ⚡ Implements logic in a single, efficient line using a ternary operator
  • 📝 Provides a clear "Yes" or "No" response

Installation

  1. Ensure Python 3 is installed on your computer.
  2. Download or save the code as Divisibility.py.
  3. Open your terminal or command prompt.
  4. Run the program:
python Divisibility.py

The program will prompt you to enter a number. After you input an integer, it will immediately display "Yes" if the number is divisible by 5, or "No" if it is not.

Output

Sample Input 1

number: 25

Sample Output 1

Yes

Sample Input 2

number: 7

Sample Output 2

No

How It Works

  • The program reads the user's input and converts it to an integer.
  • It calculates the remainder of the number divided by 5 using number % 5.
  • If the remainder is 0, the condition is true and it prints "Yes"; otherwise, it prints "No".

Notes

  • ⚠️ This script does not include error handling. Entering non-numeric characters will raise a ValueError.
  • 💡 This is an excellent example of how to write compact, readable conditional logic in Python.

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages