#include<iostream> using namespace std; int main() { long long int a; cin>>a; int d=0; for(int i = 2;i<a;i++){ int flag=0; if(a%i==0){ for(int j=2;j<=i/2;j++){ if(i%j==0 ){ flag++; break; } } if(flag==0){ if(d<i){ d=i; } } } } cout<<d; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter