Computer Science, asked by kashyapahaskar, 2 months ago

Write a Python program to find the sum of first N prime numbers. The value of N to be entered by the user.

Answers

Answered by MrElixir
8

Explanation:

numr=int(input("Enter range:"))

print("Prime numbers:",end=' ')

for n in range(1,numr):

for i in range(2,n):

if(n%i==0):

break

else:

print(n,end=' ')

Hope it will help you Dear.

Mark as brainlist

Answered by rahul123437
0

Python

Program to find the sum of first N prime numbers and the value of N is entered by the user.

If user input the number 25. This will give output as 1060.

The prime number is the number which has only 2 factors  that is one and itself. To write the program of the sum of first n prime number, it is needed to iterate each number to check if it is prime or not, and then add it up in a temporary variable.

The program is attached in the image.

Attachments:
Similar questions