Advertisement
rotti321

Max sir

Apr 6th, 2022
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int a[1000],n,i,maxim;
  7. cin >> n;
  8. for(i=1;i<=n;i=i+1) ///i=i+1 <=> i++
  9. {
  10. cin>>a[i];
  11. }
  12. maxim=a[1];
  13. for(i=2;i<=n;i=i+1){
  14. if(maxim<a[i]){
  15. maxim=a[i];
  16. }
  17. }
  18. cout<<maxim;
  19. return 0;
  20. }
Advertisement
RAW Paste Data Copied
Advertisement