#include <stdio.h> int main(int argc, char** argv) { int a[5] = {1, 3, 7, 11, 12}; int b[5] = {7, 12, 13, 14, 16}; int i = 0; int j = 0; while (i<8 && j<7) { if (a[i] < b[j]) { a[i] = -1; // mark i++; } else if (a[i] > b[j]) { b[j] = -1; // mark j++; } else { i++; j++; } } for (i=0; i < 5; i++) if ( a[i]>0 ) printf("%d ", a[i]); system("PAUSE"); return 0; }