fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a1[] = {1, 2, 3, 4, 5, 6, 7, 8};
  5. int a2[] = {1, 3, 5, 7};
  6. printf("elements of a1 not present in a2:");
  7. for (int i = 0; i < sizeof a1 / sizeof *a1; i++) {
  8. int found = 0;
  9. for (int j = 0; j < sizeof a2 / sizeof *a2; j++) {
  10. if (a1[i] == a2[j]) { found = 1; break; }
  11. }
  12. if (!found) printf(" %d", a1[i]);
  13. }
  14. puts("");
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
elements of a1 not present in a2: 2 4 6 8