Varianta 15 / Subiectul 3 / Problema 3 |
#include <iostream.h> long int n; int d, k, max, nr; int main() { nr = max = 0; cin >> n; for( int i = 1; i <= n; i++) { k = 1; d = 1; while ( d <= i/2) { if( i % d == 0) k++; d++; } if( k > max ) { nr = i; max = k; } } cout << nr << endl; system("pause"); return 0; } |