Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created May 12, 2015 05:03
Show Gist options
  • Save WideWord/58d15af59aac29f39bfb to your computer and use it in GitHub Desktop.
Save WideWord/58d15af59aac29f39bfb to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int* arr = new int[n];
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
int last = 0;
for (int i = 0; i < n; ++i) {
if (arr[i] < 0) last = arr[i];
}
if (last == 0) {
cout << "Не найден.";
} else {
cout << last;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment