#include <stdio.h>

int main() {
    int A[10] = {3,7,1,-4,10,71,5,11,20,-5};
    int P[10];
    int i;

    P[0] = A[0];
    for (i = 1; i < 10; i++) {
        P[i] = P[i-1] + A[i];
    }

    int L = 2;
    int R = 5;
    int sum;

    if (L == 0)
        sum = P[R];
    else
        sum = P[R] - P[L-1];

    printf("%d\n", sum);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: