0
Write an algorithm to find prime numbers between 1 to 10.
only algorithim
2 Antworten
+ 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