orlandoju

Ejer11_tp2

Mar 31st, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main(void){
  6.  
  7. int num1,num2,num3,num4,num5;
  8. int numpos=0;
  9.  
  10. cout<< "Ingrese el primer numero: " ;
  11. cin>> num1;
  12. cout<< "Ingrese el segundo numero: " ;
  13. cin>> num2;
  14. cout<< "Ingrese el tercer numero: " ;
  15. cin>> num3;
  16. cout<< "Ingrese el cuarto numero: " ;
  17. cin>> num4;
  18. cout<< "Ingrese el quinto numero: " ;
  19. cin>> num5;
  20.  
  21. if(num1>0){
  22. numpos++;
  23. }
  24. if(num2>0){
  25. numpos++;
  26. }
  27. if(num3>0){
  28. numpos++;
  29. }
  30. if(num4>0){
  31. numpos++;
  32. }
  33. if(num5>0){
  34. numpos++;
  35. }
  36.  
  37. cout<<"La cantidad de numeros positivos es: "<<numpos;
  38.  
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment