View Code of Problem 51

#include <stdio.h>

int main(void) {
  int size, value, sum = 0;
  scanf("%d", &size);
  for (int y = 0; y < size; y++) {
    for (int x = 0; x < size; x++) {
      scanf("%d", &value);
      if (x <= y) {
        sum += value;
      }
    }
  }
  printf("%d\n", sum);
  
  return 0;
}

Double click to view unformatted code.


Back to problem 51