orlandoju

Ejer14_tp3

Apr 14th, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main(void){
  6.  
  7.     int i,n;
  8.     int contdiv=0;
  9.     cout<< " Ingrese un numero: "<<endl;
  10.     cout<<"--------------------"<<endl;
  11.     cin>>n;
  12.     for(i=1;i<=n;i++){
  13.         if(n%i== 0){
  14.           contdiv++;
  15.         }
  16.     }
  17.         cout<<"--------------------"<<endl;
  18.       cout<<"Los cantidad de divisores son: "<<contdiv<<endl;
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment