SHARE
TWEET

Untitled

a guest Sep 17th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int N;
  6.     cin >> N;
  7.     int *a = new int[N+1];
  8.     for (int i = 1; i <= N; i++)
  9.     {
  10.         cin >> a[i];
  11.     }
  12.     int min;
  13.     min = a[1];
  14.     for (int i = 1; i <= N; i++)
  15.     {
  16.         if (abs(a[i]) < min)
  17.         {
  18.             min = abs(a[i]);
  19.         }
  20.     }
  21.     int nullcounter=0;
  22.     int sum = 0;
  23.     for (int i = 1; i <= N; i++)
  24.     {
  25.         if (a[i] == 0)
  26.         {
  27.             nullcounter++;
  28.         }
  29.         if (nullcounter > 0)
  30.         {
  31.             sum += abs(a[i]);
  32.         }
  33.  
  34.     }
  35.     int temp=0;
  36.     for (int i = 1; i <= N/2; i++)
  37.     {
  38.         temp = a[i];
  39.         for (int j = i; j < N; j++)
  40.         {
  41.             a[j] = a[j + 1];
  42.         }
  43.         a[N] = temp;
  44.     }
  45.     for (int i = 1; i <= N; i++)
  46.     {
  47.         cout << a[i] << " ";
  48.     }
  49. }
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