Join Regular Classroom : Visit ClassroomTech

Revature Question Solve | Even Composite Number | Codewindow.in

Write a program to display even composite number (non prime numbers) between 1 and entered number(inclusive)
display numbers separated by space.

Example: 
Input
5
Output
4

Example:
Between 1 and 5,
2, 3 and 5 are primes and 4 are even.

Solution:
1. Pyhton 3.7:

#code by codewindow.in
sampleInput = input()

n=int(sampleInput)

for i in range(3,n+1):
    if i%2==0:
        x=str(i)+" "
print(x)

Also Checkout

Recent Posts
Pages