Skip to main content

Computer Science Practical File Question | Class 11 CBSE | 2021-22 Session|

CS Practical File Question

 Q. Write a program to display first n prime numbers.

Answer →
n=int(input('Enter the number of prime numbers needed:'))
j=2
while n!=0:
    for i in range(2,j):
        if j%i==0:
            break
    else:
        print(j,end=' ')
        n=n-1
    j=j+1


Comments

Popular posts from this blog