Advertisement
khristian3000

Untitled

Apr 19th, 2020
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int p=0,c=0,n,x,mp,mn;
  8.  
  9. for (x=1;x<=4;x++){
  10.  
  11.     cout << "Ingrese un numero: ";
  12.     cin >> n;
  13.     if (n<0) { c++;
  14.     if (c==1) {mn=n;}
  15.     else {
  16.     if (n>mn) {mn=n;}
  17.     }
  18.     }
  19.     else {
  20.     p++;
  21.     if (p==1) {mp=n;}
  22.     else {
  23.     if (n>mp) {mp=n;}
  24.     }
  25.     }
  26. }
  27.     cout << "El Maximo Negativo es: " << mn << endl;
  28.     cout << "El Minimo Positivo es: " << mp << endl;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement