SHARE
TWEET

Untitled

a guest Jun 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int a,n,i, nr_afisare, nr_divizori;
  6.     nr_divizori = 1;
  7.     n = 0;
  8.     a = 0;
  9.     nr_afisare = 0;
  10.     while (n>= 0) {
  11.         cin >> n;
  12.         for (i = 1; i <= n; i++) {
  13.             if (n%i==0) {
  14.                 a += 1;
  15.             }
  16.         }
  17.         if (a > nr_divizori) {
  18.             nr_divizori = a;
  19.             nr_afisare = n;
  20.         }
  21.         a = 0;
  22.     }
  23.  
  24.     cout << "numarul cu cei mai multi divizori este: " << nr_afisare << " si are " << nr_divizori<< " divizori";
  25.  
  26.  
  27.     system("pause");
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top