Question #303557

Write a program that will input 20 values to array BSIT and to sum up the content of all even index. Print array BSIT and the sum of all even index.

Expert's answer

#include <stdio.h>

int arr[20];

int main() {
  for (int i = 0; i < 20; i++) {
    scanf("%d", &arr[i]);
  }
  int sum = 0;
  for (int i = 0; i < 20; i += 2) {
    sum += arr[i];
  }
  printf("%d", sum);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS