Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Even or odd and Prime or nor-prime #558

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions projects/Odd or Even as Well as Prime or Not/Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


'''
Name: Prajwal Kedari
Country:India
GitHub: prajwalkedari , prajwal-kedari
Link: https://www.github.com/prajwalkedari/
Source: Python-world
Thank!!!
'''

num = int(input("Enter a number: "))
if (num % 2) == 0:
Odd_or_even_result=f"{num} is Even as well as"
else:
Odd_or_even_result=f"{num} is Odd as well as"
if num > 1:
for i in range(2, int(num/2)+1):
if (num % i) == 0:
prime_or_not_result=" nor prime number"
break
else:
prime_or_not_result=" prime number"
else:
prime_or_not_result=" nor prime number"

print(Odd_or_even_result,prime_or_not_result)
37 changes: 37 additions & 0 deletions projects/Odd or Even as Well as Prime or Not/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Odd or Even as Well as Prime or Not

Simple Python program for check a number is an Odd or even as well as Prime or Nor prime
<Br>

## Prerequisites
You only need Python3 to run this script. You can visit [here](https://www.python.org/downloads/) to download Python.

<Br>

## How to run the script
Running the script is really simple! Just open a terminal(cmd) in the folder where your script is located and run the following command :
```bash
python main.py
```
<Br>

## Sample use of the script

``` bash
$python main.py
Enter a number : 5
5 is a odd as well as Prime number

$python main.py
Enter a number : 9
9 is a odd as well as Nor-Prime number

$python main.py
Enter a number : 6
6 is a even as well as Nor-Prime number
```
<Br>

## Author
[@prajwalkedari](https://github.com/prajwalkedari)<br>
@prajwalkedari