Programming Examples
Python program to check given number is composite number or not
Write a Python program to accept a integer number from user and check number is composite Number or not.
Composite number is a whole numbers that have on 1 or more than 1 factors excluding 1 and itself. Â
Solution
num=int(input("Enter any Number : "))
count=0
for a in range(2,num):
if num%a==0:
count+=1
if count>=1:
print(num, "is Composite Number")
else:
print(num, "is Prime Number")
Output/ Explanation:
Enter any Number : 10
10 is Composite Number
=========================Â
Enter any Number : 11
11 is Prime Number