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 found, print "1" otherwise "O
Answers
Answered by
0
Answer:
You are given an array of integers of size N. Can you find the sum of the elements in the array?
Yes we can find the sum of elements in an array;
example:
#include <stdio.h>
int main()
{
int a[5]={1,2,3,4,5}; // Here N is 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;
}
Answered by
0
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;
Similar questions