// A nested loop.
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);

  int *A = new int[n];
  int *B = new int[n];

  for (int i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
  }

  for (int i = 0; i < n; ++i) {
    scanf("%d", &B[i]);
  }

  int sum = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      sum += A[i] * B[j];
    }
  }
  printf("%d\n", sum);

  delete[] A;
  delete[] B;
}

Add nested loop example specimen 5
Add nested loop example specimen 5
