numeros
Publicado por kelly (17 intervenciones) el 26/10/2022 05:31:57
Lea N números ( >= cero), informe cual fue el mayor número leído
Valora esta pregunta


0
#include <iostream>
using namespace std;
int main()
{
int sz, n, max;
cout << "Cuantos numeros: "; cin >> sz;
for (int i = 0; i < sz; i++)
{
do {
cout << "Numero " << i + 1 << ": ";
cin >> n;
} while(n <= 0);
if (i == 0 || max < n) max = n;
}
cout << endl << "Mayor: " << max << endl;
return 0;
}