Advertisement
orlandoju

Ejer5_tp3

Apr 6th, 2022
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main(void){
  6.  
  7. int i,n1,n2,pos=0;
  8.     cout<< " Ingrese la cantidad de numeros a listar: "<<endl;
  9.     cin>>n1;
  10.      cout<<"--------------------"<<endl;
  11.      cout << "Ingrese el listado de los: "<<n1<< " numeros que eligio" <<endl;
  12.    for (i = 0; i < n1; i++){
  13.  
  14.         cin>> n2;
  15.     if(n2>0)
  16.         pos++;
  17.    }
  18.     cout<<"--------------------"<<endl;
  19.     cout << "La cantidad de numeros positivos son:  "<<pos<< endl;
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement