Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- using namespace std;
- #define TAM 100
- #define NUMERO_MIN -9999
- int main() {
- int i, n[TAM], maior1 = NUMERO_MIN, maior2 = NUMERO_MIN;
- for (i = 0; i < TAM; i++) {
- cout << "n[" << i << "]: ";
- cin >> n[i];
- if (n[i] > maior1) {
- maior2 = maior1;
- maior1 = n[i];
- }
- else if (n[i] > maior2 && n[i] != maior1) {
- maior2 = n[i];
- }
- }
- cout << "1 maior: " << maior1 << endl;
- cout << "2 maior: " << maior2 << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement