Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import Foundation
import Glibc
func prime(X: Float ,Y: Float) {
var n = X
var i = Y
if n==0{
//print("n is 0")
}
if n==1{
//print("n is 1")
}
else if(n.truncatingRemainder(dividingBy: i)==0){
print(String(Int(i)))
n=n/i
prime(X:n,Y:i)
}
else{
i = i+1
prime(X:n,Y:i)
}
}
let inp = readLine()
var n: Float = Float(inp!)!
prime(X: n, Y: 2)
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more