in Programming and DS recategorized by
8,224 views
2 votes
2 votes

What is the output of the following program?

#include<stdio.h>
main()
{
int a, b =0;
static int c[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
for (a=0; a<10; ++a)
int ((c[a]%2)==0) b+=c[a];
printf(“%d”, b);
}
  1. 15
  2. 25
  3. 45
  4. 20
in Programming and DS recategorized by
8.2k views

1 Answer

1 vote
1 vote

Given code is


for (a=0; a<10; ++a)
int ((c[a]%2)==0) b+=c[a];

for loop will read each value in array.

If value will is even it is added to b

b =2+4+6+8+0 =20

Ans :20

by

1 comment

int ((c[a]%2)==0) b+=c[a];

it should be

if((c[a]%2)==0) b+=c[a];

 right ??

0
0
Answer:

Related questions