Computer Science, asked by clmanasvimathur, 2 months ago

write a python program​

Answers

Answered by nidhinantonydevasia
0

Answer:

# Program to check if a number is prime or not

num = 29

# 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")

Answered by BeautifulWitch
1

Answer:

Add Two Numbers With User Input

Input :

# Store input numbers

num1 = input('Enter first number: ')

num2 = input('Enter second number: ')

# Add two numbers

sum = float(num1) + float(num2)

# Display the sum

print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

Explanation:

Hope this helps you ✌️

Similar questions