func prime(n: Int){
var count = 0
for i in 1...n
{
if(n%i==0)
{
count+=1
}
}
if(count==2)
{
print(" Prime number \(n)")
}
else
{
print("Prime Not Number\(n)")
}
}
for j in 1...20
{
prime(n:j)
}
func prime(n: Int){
var count = 0
for i in 1...n
{
if(n%i==0)
{
count+=1
}
}
if(count==2)
{
print(" Prime number \(n)")
}
else
{
print("Prime Not Number\(n)")
}
}
for j in 1...20
{
prime(n:j)
}
No comments:
Post a Comment