Answers

2014-04-23T11:47:15+05:30
Include <stdio.h> 
int main(void)
 {
 int v[] = { 1, 2, 3, 4 }; 
int i, sum; 
for (sum = i = 0;
i < sizeof v / sizeof (int); ++i)
 sum += !(v[i] & 1) * v[i]; 
printf("%d\n",sum); return 0;
 } 

0
2014-04-23T12:45:49+05:30
Class x
{
public void cal(int a[])
{
int s1=0,s2=0;
for(int i=0;i<=10;i++)
{
if(a[i]%2==0)
s1+=a[i];
else
s2+=a[i];
}
System.out.println("sum of even=+s1);
System.out.println("sum of odd=+s2);
}
}
0