Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /** 7) Hacer un programa para ingresar una lista de 10 números, luego informar cuántos son
- positivos, cuántos son negativos, y cuántos iguales a cero. **/
- using namespace std;
- int main()
- {
- int cv,pos=0, neg=0, cero=0, n, nverf;
- cout<< "ingrese la cantidad de numeros a verificar: ";
- cin>>n;
- for(cv=1; cv<=n; cv++)
- {
- cout<< "ingrese el numero a verificar:";
- cin>>nverf;
- if(nverf>0)
- {
- pos++;
- }
- else
- {
- if(nverf<0)
- {
- neg++;
- }
- else
- {
- cero++;
- }
- }
- }
- cout<< "numeros positivos: "<< pos<< endl;
- cout<< "numeros iguales a cero: "<< cero<<endl;
- cout<< "numeros negativos: "<< neg<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement