62 570
Assignments Done
99%
Successfully Done
In June 2018

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
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions