+ 1

Flowchart

Hi please draw a flowchart to print prime numbers between 50 and 150.

20th Jan 2025, 8:52 PM
Aman
1 Respuesta
+ 1
2 loops - one nested inside the other Outer loop - loop over the integers between 50 and 150 Inner loop - loop between 2 and (current outer loop integer - 1) Body of Inner loop - If outer loop integer divided by inner loop integer has remainder 0, set NOT PRIME flag After inner loop - if NOT PRIME flag not set, you have found a Prime number and can print it. You could also speed up inner loop by breaking out of it if you find a non-prime. If the inner loop counter = outer loop counter after inner loop exited (i.e. inner loop ran all way through), then PRIME and print, else NOT PRIME
20th Jan 2025, 9:10 PM
Shardis Wolfe