Advertisement
STANAANDREY

P2 ian

Jan 28th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. unsigned long n,x,nrd,nrd_max=0,i,res;
  8.  
  9. cout<<"n=";cin>>n;
  10.  
  11. for (i=1;i<=n;i++)
  12. {
  13.     cin>>x;
  14.     nrd=2;
  15.     for (int d=2;d<=x/2;d++)
  16.     if (x%d==0)
  17.     nrd++;
  18.  
  19.     if (nrd_max<nrd) {
  20.         nrd_max=nrd;
  21.      res=x;
  22.     }
  23. }
  24. cout<<"nr "<<res<<" are "<<nrd_max<<" divizori";
  25.  return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement