Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- void promeni(int *niza, int n) {
- int sum = 0;
- for(int i = 0; i < n; i++) {
- sum += niza[i];
- *(niza + i) = sum;
- }
- }
- int main() {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- promeni(niza, n);
- for(int i = 0; i < n; i++) {
- printf("%d ", niza[i]);
- }
- }
- // 1 2 3 4 5
- // 1 3 6 10 15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement