Computer Science, asked by Anonymous, 10 months ago

Answer the attachment :D​

Attachments:

Answers

Answered by Anonymous
4

hyy mate ✌️

# Python program to check if

# given number is prime or not

num = 11

# If given number is greater than 1

if num > 1:

# Iterate from 2 to n / 2

for i in range(2, num//2):

# If num is divisible by any number between

# 2 and n / 2, it is not prime

if (num % i) == 0:

print(num, "is not a prime number")

break

else:

print(num, "is a prime number")

hope it will help you ❣️❣️

Answered by Anonymous
9

\huge\mathbb{ANSWER}

n=int(input("enter the value"))

flag=0

i=2

while(i<n):

if(n%2==0):

flag=1

break

i=i+1

if(flag==1):

print("not prime")

elif(flag==0):

print("number is prime")

else:print("number not defined")

note: screenshot of program is in attachment.

\huge\bold\red{THANK YOU }

Attachments:
Similar questions