Created
December 11, 2013 12:55
-
-
Save joepreludian/7909951 to your computer and use it in GitHub Desktop.
Primeira questão de Eliselma - Trabalho.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 1) Negativo | |
// | |
// Lê 5 valores inteiros, um de cada vez, conta quantos destes valores são negativos e imprime esta informação. | |
// | |
#include <iostream> | |
using namespace std; | |
int main(int argc, const char * argv[]) | |
{ | |
cout << "Números negativos\n\nPor favor, insira 5 numeros:\n"; | |
int quantidade_negativos = 0; | |
int numero; | |
for (int i=1; i<=5; i++) { | |
cout << "Entre com o " << i << "o numero: "; | |
cin >> numero; | |
if (numero < 0) { | |
quantidade_negativos++; | |
} | |
} | |
cout << "A quantidade de números negativos foi: " << quantidade_negativos; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment