#include <iostream>
using namespace std;
int main() {
int n;
setlocale(LC_ALL, "");
cout <<"Введите количество чисел: ";
cin >> n;
int *arr = new int[n];
// Ввод чисел в массив
cout << "Введите " << n << " чисел:" << endl;
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
// Поиск наибольшего числа
int max_value = arr[0];
for (int i = 1; i < n; ++i) {
if (arr[i] > max_value) {
max_value = arr[i];
}
}
// Вывод результата
cout << "Наибольшее число: " << max_value<< endl;
delete[] arr;
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter