提交时间:2024-01-30 15:52:35
运行 ID: 39074
#include<iostream> #include<cmath> using namespace std; int findLargerPrime(int num) { int largerPrime = 0; for (int i=2;i<=sqrt(num);i++) { if (num%i==0) { largerPrime=max(i, num / i); } } return largerPrime; } int main() { int num; cin>>num; int largerPrime=findLargerPrime(num); cout<<largerPrime<<endl; return 0; }