Saved Bookmarks
| 1. |
Write a method in Python and display the prime numbers between 2 to N. Pass as argument to the methods. |
|
Answer» def prime (N) : for a in range (2, N) Prime=1 for I in range (2, a): if a%i= = 0 : Prime = 0 if Prime = = 1: print a OR def prime (N) : for a in range (2, N): for I in range (2, a) : if a%i = = 0: break else : print a OR Any other correct code performing the same |
|