fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int bil;
  6. cin >> bil;
  7.  
  8. int faktor = 0;
  9. for(int i = 1; i <= bil; i++)
  10. if(bil%i == 0)
  11. faktor++;
  12.  
  13. cout << faktor << endl;
  14. return 0;
  15. }
  16.  
  17. // 24
  18. // Faktor: 1 2 3 4 6 8 12 24
  19. // i: 1 2 3 4 5 6 .. 24
  20. // 24/1 = 0/1 + 24 -> a = 24%1 = 0
  21. // 24/7 = 3/7 + 3 -> a = 24%7 = 3
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
4