Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- void main()
- {
- int n, numl, cantpos, cantneg, mayor, menor;
- float suma;
- suma = 0;
- numl = cantpos = cantneg = 0;
- do
- {
- cout << "Ingrese numero:";cin >> n;
- if (n != 0)
- {
- numl++;
- if (n > 0)
- cantpos++;
- else
- cantneg++;
- if (numl == 1)
- mayor = menor = n;
- else
- {
- if (n > mayor)
- mayor = n;
- if (n < menor)
- menor = n;
- }
- suma = suma + n;
- }
- } while (n != 0);
- cout << "Numeros leidos=" << numl << endl;
- cout << "Numeros positivos=" << cantpos << endl;
- cout << "Numeros negativos=" << cantneg << endl;
- if (numl > 0)
- {
- cout << "Mayor=" << mayor<< endl;
- cout << "Menor=" << menor << endl;
- cout << "Promedio=" << suma/numl;
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement