WAP a input a number and display either the number is prime or composite.
Answers
Answered by
0
Answer:
#include<stdio.h>
int main()
{
int i,n,c=0;
printf ("Enter a number n");
scanf ("%d",&n);
for (i=1;i<=n;i++)
{
if(n%i==0)
c=c+1;
}
if (c==2)
printf ("The number is PRIME");
else
printf ("The number is COMPOSITE");
return 0;
}
Answered by
0
Answer:
i=int(input("Enter the number: "))
for j in range(2,i):
if i%j==0:
print("Composite")
break
else:
continue
else:
print("Prime Number")
Similar questions