orlandoju

Ejer6_tp3

Apr 6th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main(void){
  6.  
  7.     int i,n1,pos=0,cero=0,neg=0;
  8.     cout<< " Ingrese la cantidad de numeros 10 numeros: "<<endl;
  9.  
  10.    for (i = 0; i < 10; i++){
  11.  
  12.     cin>>n1;
  13.     if(n1>0){
  14.         pos++;
  15.     }
  16.     else
  17.     if(n1<0){
  18.         neg++;
  19.     }
  20.     else{
  21.     cero++;
  22.     }
  23.  
  24.    }
  25.     cout<<"--------------------"<<endl;
  26.     cout << "La cantidad de numeros positivos son:  "<<pos<< endl;
  27.  
  28.      cout<<"--------------------"<<endl;
  29.     cout << "La cantidad de numeros negativos son:  "<<neg<< endl;
  30.  
  31.      cout<<"--------------------"<<endl;
  32.     cout << "La cantidad de numeros positivos son:  "<<cero<< endl;
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment