Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //goo.gl/mohDkE
- #include <iostream>
- #include <cmath>
- using namespace std;
- int MinDivisor(int n) {
- for (int i = 2; i < sqrt(n); i++) {
- if (n % i == 0) {
- return i;
- }
- }
- return n;
- }
- int main() {
- int n;
- cin >> n;
- cout << MinDivisor(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement