Advertisement
Andrey_ZoZ

K

Sep 4th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. int main()
  4. {
  5.     int count;
  6.     std::cin>>count;
  7.     count=abs(count);
  8.     double* massive=new double[count];
  9.     for (int index{0}; index<count; ++index) {
  10.         std::cin>>massive[index];
  11.     }
  12.     double max;
  13.     if(massive[0]<0){max=massive[0]*-1;}
  14.     else{max=massive[0];}
  15.     for (int index{1}; index<count; ++index) {
  16.         if(massive[index]<0){if(massive[index]*-1>max){max=massive[index]*-1;}}
  17.         else{if(massive[index]>max){max=massive[index];}}
  18.     }
  19.     std::cout<<max;
  20.    
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement