Assignment 1

4. Determine if the input number is Prime and Composite.

CPE102L
1Q1819
start

factor=2,prime=1
input num

if (num==1 or num==2 or num==3 or num==0)
	print “Prime”
else
	while(factor<=num/2)
		if (num%factor==0)
			prime=0
factor=num
endif
factor++
	endwhile
	
	if (prime==1)
		print “prime”
	else
		print “composite”
	endif
endif

end