csansoon

P6.08 P71753 Maximum of each sequence

Nov 7th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n,x,max;
  6.     while (cin>>n) {
  7.         cin>>max;
  8.         for (n;n-1>0;n--) {
  9.             cin>>x;
  10.             if(x>max) max=x;
  11.         }
  12.         cout<<max<<endl;
  13.     }
  14. }
Add Comment
Please, Sign In to add comment