Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/812a95d71a706bc2391e1640991adc45 to your computer and use it in GitHub Desktop.
Save invatainfo/812a95d71a706bc2391e1640991adc45 to your computer and use it in GitHub Desktop.
#include <iostream.h>
void main() {
int n, a[100], s = 0, i;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> a[i];
s = s + a[i];
}
for (i = n; i >= 1; i--) {
cout << s << " ";
s = s - a[i];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment