Given an array, Arr[] of integer numbers have size N.
The task is to find out single or consecutive numbers
from Arr[] with O sum. When
punt "1" otherwise "O".
45989 Yund,
4598931161 58
Example-1:
Input:
4
→ Value of N
{6,-2,3,-1} Element of Arr[]
Output:
1
Game 98
4598931161 58
4598931161 58
Input:
5
→ Value of N
{5,1,2,3,-4} - Element of Arr[]
Output:
0
Explanation:
In example-1, the number list is 6,-2,3,-1.here (-2) + 3
+(-1) =0. So we can get consecutive numbers
in Arr[] and its sum is 0. Hence the output is 1.
In example-2, the number list is 5, 1, 2, 3,-4. Any
Answers
Answer:
Explanation:
From the given question the program for Arr[] of integer numbers have size N. The task is to find out single or consecutive numbers from Arr[] with O sum. When found, print "1" otherwise "O is
#include <stdio.h>
int main()
{
// let consider the N is 5;
int a[5]={1,2,3,4,5};
int sum = 0, I;
for(I=0;i<5;i++)
{
sum = sum + a[I];
}
printf("Sum of elements in an array is %d\n", sum);
return 0;
For ease of understanding, imagine an array as a flight of stairs with a value (let's say, one of your friends) placed on each level. Any of your pals can be located here by merely knowing how many steps they have left to go. The array in C has a fixed size, which means that once the size is specified, it cannot be modified; you cannot shrink or extend it. The rationale for this was that, when expanding, we cannot always be certain that we will receive the subsequent memory location for free (it is not always possible). Because the array is allocated memory statically when declared, downsizing will not operate.
See more:
https://brainly.in/question/44549912
#SPJ1