Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N;
- cin >> N;
- int *a = new int[N+1];
- for (int i = 1; i <= N; i++)
- {
- cin >> a[i];
- }
- int min;
- min = a[1];
- for (int i = 1; i <= N; i++)
- {
- if (abs(a[i]) < min)
- {
- min = abs(a[i]);
- }
- }
- int nullcounter=0;
- int sum = 0;
- for (int i = 1; i <= N; i++)
- {
- if (a[i] == 0)
- {
- nullcounter++;
- }
- if (nullcounter > 0)
- {
- sum += abs(a[i]);
- }
- }
- int temp=0;
- for (int i = 1; i <= N/2; i++)
- {
- temp = a[i];
- for (int j = i; j < N; j++)
- {
- a[j] = a[j + 1];
- }
- a[N] = temp;
- }
- for (int i = 1; i <= N; i++)
- {
- cout << a[i] << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement