# Answer to Question #45389 in C++ for Madzkie Sarion

Question #45389

Problem Description

Given a set of integers

Print out the maximum per line.

The first number per line indicates the number of integers following it.

The first number per line should not be included in the process.

Input

zroeD.in

Output

standard output

Sample Input

4 6 5 4 7

9 2 6 5 8 4 5 7 3 6

7 4 2 5 7 3 4 3

Sample Output

7

8

7

Given a set of integers

Print out the maximum per line.

The first number per line indicates the number of integers following it.

The first number per line should not be included in the process.

Input

zroeD.in

Output

standard output

Sample Input

4 6 5 4 7

9 2 6 5 8 4 5 7 3 6

7 4 2 5 7 3 4 3

Sample Output

7

8

7

Expert's answer

`#include <iostream>`

int main() {

int quantity;

std::cin >> quantity;

int array[quantity];

for ( int i = 0; i < quantity; i++ ) {

std::cin >> array[i];

}

int max = array[0];

for ( int i = 0; i < quantity; i++ ) {

if ( array[i] > max ) {

max = array[i];

}

}

std::cout << max << std::endl;

}

## Comments

## Leave a comment