0
Write an algorithm to find prime numbers between 1 to 10.
only algorithim
3 Answers
+ 2
This trick also works for fetching prime numbers from 1 to 100
đ´Get numbers from 1 to 100
đ´ Remove 1 because it is neither prime nor composite.
đ´ If a number except 2 is divisible by 2, remove them from list. eg: remove:4,6,8,10,...
đ´ remove all the numbers that are divisible by 3 except 3 itself. eg: remove 9, 15, 21,...
đ´ Similarly remove all the numbers divisible by 5 except 5.
Now the numbers left are prime
0
This is very useful for me thanks