#include <bits/stdc++.h>
using namespace std;
int main () {
int arr[] = {7, 2, 8, 5, 8, 2, 1, 3, 5};
int n = 9;
int greatest = -100;
int secondgreatest = -100;
for (int i=0; i < n; i++) {
if (arr[i] > greatest){
secondgreatest = greatest;
greatest = arr[i];
}
else if (arr[i] > secondgreatest && arr[i] != greatest) {
secondgreatest = arr[i];
}
}
cout<<secondgreatest;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: