1#include <iostream>
2int main()
3{
4 std::cout << "Enter 5 numbers : ";
5 int arr[5];
6
7 for (int i = 0; i < 5; std::cin >> arr[i++]);
8
9 int max = arr[0], second = 0;
10
11 for (int i = 1; i < 5; i++)
12 if (arr[i] > max)
13 max = arr[i];
14 std::cout << "Maximum number : " << max << "\n";
15 bool found = false;
16 for (int i = 0; i < 5; i++)
17 {
18 if (arr[i] == max)
19 continue;
20 else if (arr[i] > second)
21 {
22 second = arr[i];
23 found = true;
24 }
25 }
26 if (found)
27 std::cout << "Second maximum numbers : " << second;
28 else
29 std::cout << "Second maximum number not found.";
30}