#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
long long int a[10^9],sum=0;
int n,i,length;
scanf("%d",&n);
for(i=0;i<n;i++)
{
if(0<=a[i]<=10^10)
{
scanf("%lld",&a[i]);
}
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
printf("%lld",sum);
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}
i dont know the reason why i am getting the segentation fault this code runs fine for this input 1000000001 1000000002 1000000003 1000000004 1000000005
^is the XOR operator in C, not the exponent operator.10 ^ 9 == 3;10 ^ 10 == 0.0<=a[i]<=10^10is legal, but it doesn't do what you think it does. It's equivalent to(0 <= a[i]) <= 10^10.(0 <= a[i])yields either0or1; that value is then compared to10^10, which is0.^has lower priority than<=, so<= 10^10should be change to<= (10^10).0<=a[i]<=10^10is equivalent to((0 <= a[i]) <= 10) ^ 10(I hope I got that right this time!)