I am very new to arrays and programming in general.
Question: Finding the intersection
Code:#include <stdio.h> int main (void) { int A[] = {1, 2, 5}; int B[] = {1, 5, 9, 10}; int n, k, sum = 0; for( n = 1; n < 6; n++) for( k = 1; n < 10; k++) { if(n == k) { sum += k; printf("%d and %d are the intersection", sum, k); } } }
I doubt this is anywhere close to being right. But I am looking for help, tips, etc...but I do not want the answer given to me.