Computer Science, asked by jhagopalnayan10, 5 months ago

write an algorithm and draw a flowchart to find prime numbers between 1 to 100​

Answers

Answered by anshup2308
12

Explanation:

hopes it helps..

stay safe stay blessed

Attachments:
Answered by rafiaibrahim903
1

Answer: 2,3,5,7,11,13,17,19,23,29,31,37,41,43, 47,53, 59, 61, 67, 71, 73,79,83,89, 97

Explanation:

  • Create a variable called Sum and set its value to 0
  • Using for loop, read a list of numbers from 1 to 100(in your example).
  • Create a count variable and set it to 0
  • Repeat until the first loop is complete.
  • The idea behind prime is that num percent itself or num percent num = 0 is prime, whereas others aren't.
  • Increase the number of people.
  • If the count is 2 (for example, 2/1=2), the remainder (2 percent 1) is 0 and the remainder (2 percent 2) is 0 The number must be prime else it will not be prime.
  • Increase the total by the prime number you just got.

sum = 0  

n1, n2 = map( int, input("Enter numbers with 'SPACE' where 'Start = 2' and End is number of primes required: ").split())  

for i in range(n1, n2):

   count = 0    

for j in range(1, i + 1):

       if i % j == 0:

           count += 1    

if count == 2:

      print(f"The Prime Number's are: {i}")

      sum += i  

print(f'The summation of Prime Numbers from {n1} to {n2} are: {sum}')  

Output:

Enter numbers with 'SPACE' where 'Start = 2' and End is the number of primes required: 2 100

The Prime Numbers are: 2,3,5,7,11,13,17,19,23,29,31,37,41,43, 47,53, 59, 61, 67, 71, 73,79,83,89, 97

#SPJ2

Attachments:
Similar questions