Skip to main content

Composite Number

 

Title: Check whether the given number is Composite or not

If any number contains more than two factors that number is called composite number.

Program:

n=int(input("Enter n value\n"))

c=0

for i in range(1,n+1):

    if(n%i==0):

        c=c+1

if(c>2):

    print(n," is a composite number")

else:

    print(n," is not a composite number")

Output:

            Enter n value

8

8  is a composite number

Comments