B03D-2015 – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2015-B03D #PYTHON#6372    siteicon   siteicon  

Problem Statement - B03D-2015

Write a method in python to find and display the composite numbers between 2 to N. Pass N as argument to the method.

Solution

TC++ #6372

def composite_numbers(N):
   for I in range(2, N+1):
       M = I // 2
       for J in range(2, M+1):
           if I % J == 0:
               print(I)
               break


Share

CSKC| Created: 11-Jan-2019 | Updated: 11-Jan-2019|CBSE12A-2015









Back