Problem discussion
To solve Simple Array Sum you just need to know the Array and Array excessing method.
Just declare an integer array and input the array. Sum the Array elements during inputs. Next, you just have to print the sum. That’s all.
Now try to solve the problem. If you still get failed to solve the problem, just look at the below code and try again but please don’t copy the code, it is dangerous for your progress.
Source code
Before seeing the source code ensure that you have tried hard most!!!
#include<stdio.h>
int main()
{
int number;
scanf("%d", &number);
int array[number];;
int index;
int sum = 0;
for(index = 0; index < number; index++)
{
scanf("%d", &array[index]);
sum += array[index];
}
printf("%d\n", sum);
return 0;
}
Be with us, stay happy. Please do your precious comment and give an opportunity to improve us.
Happy coding.
Leave a comment