Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define xstr(s) str(s)
- #define str(s) #s
- #define MAXN 20
- #define PREFSUM MAXN + 1
- #define FIRST 0
- #define F for (int i = 1; i < n + 1; ++i)
- #define GETINT(b) scanf("%d",&b)
- #define INVITE1 "Enter number of elements\n"
- #define INVITE2 "Enter elements\n"
- #define PRINT(a) printf(a)
- #define PRINTINT(a) printf("%d ",a)
- int main(void) {
- int ar[MAXN];
- int s[PREFSUM]; s[FIRST] = 0;
- int n;
- PRINT(INVITE1);
- GETINT(n);
- PRINT(INVITE2);
- F
- {
- GETINT(ar[i - 1]);
- s[i] = ar[i - 1] + s[i - 1];
- }
- F PRINTINT(s[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement