Skip to content

cdumplins/-CNE310_-Calvin-Davis-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

-CNE310_-Calvin-Davis-

Program to check if a number is prime or not

num = 11

To take input from the user

#num = int(input("Enter a number: "))

define a flag variable

flag = False

prime numbers are greater than 1

if num > 1: # check for factors for i in range(2, num): if (num % i) == 0: # if factor is found, set flag to True flag = True # break out of loop break

check if flag is True

if flag: print(num, "is not a prime number") else: print(num, "is a prime number")

Releases

No releases published

Packages

No packages published