#include <stdio.h> #include <stdint.h> int calculator_checksum(int *mem, int n){ int check = 0; for(int i = 0; i < n - 1; i++){ check ^= mem[i]; } if(check == mem[n-1]){ return 1; } else{ return 0; } } int main(){ int n, arr[100]; scanf("%d",&n); for(int i = 0; i < n; i++){ scanf("%d",&arr[i]); } printf("%d",calculator_checksum(arr, n)); return 0; }
Solving Approach
Test Cases
Test Results
Input
5 10 20 30 40 60
Expected Output
0