【題目敘述】https://zerojudge.tw/ShowProblem?problemid=a695
#include <iostream>
using namespace std;
int main() {
int n, i;
while (cin >> n){
for (i = 2; i * i <= n; i++){
if (n % i == 0) break;
}
cout << n / i << "\n";
}
return 0;
}
Python code (credit: Amy Chou)
n = int(input())
for i in range(2, int(n**0.5)+1):
if n % i == 0:
break
print(n // i)