You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Write a program sum.c given an array of n integers where n > 1, return an array of same size as the input array where every index of the output array is the cumulative sum of elements in the array so far. You can have it so that the array is input by the user.*/
#include <stdio.h>
#include <string.h>
int main(){
int num1[100];
int i=0;
int counter=0;
char x;
printf("Enter integers:\n");
do /*inputs variables*/
{
scanf("%d", &num1[i]);
i++;
counter++;
}
while (getchar()!='\n');
printf("counter is %d\n", counter);
for (i=0;i<counter; i++) /*if num is negative, subtract one from the counter*/