SHARE
TWEET

#8

a guest Feb 22nd, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(int argc, char** argv) {
  5.    
  6.     int n,i,max_razlika=0;
  7.    
  8.     cout << "Vnesi broj na elementi vo nizata" << endl;
  9.     cin >> n;
  10.    
  11.     int a[n];
  12.     cout << "Vnesi " << n << " element(i) vo nizata 'a'" << endl;
  13.     for(i = 0; i < n; i++) {
  14.         cin >> a[i];
  15.     }
  16.     cout << endl;
  17.    
  18.     for(i=0 ; i<n-1 ; i++){
  19.         if(a[i] - a[i+1] > max_razlika){
  20.             max_razlika = a[i] - a[i+1];
  21.         }
  22.     }
  23.    
  24.     cout << "Najgolemata razlika pomegju dva soseda iznesuva " << max_razlika;
  25.    
  26.     return 0;  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top