#include <stdio.h>

#define BOOLEAN unsigned short
#define TRUE 1
#define FALSE 0
#define TEN 10
//---------------------------------------------------------------------------------------
//                                              Exercise 1
//                                              ----------
//
// General : The program checks if there is at least one common digit between 2 numbers.
//
// Input   : 2 numbers.
//
// Process : The program checks check every digit of 2 numbers.
//
// Output  : 0(FALSE), 1(TRUE).
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date       : 23.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
    short num1,
          num2,
          temp_num1,
          temp_num2,
          digit_num1,
          digit_num2;
    BOOLEAN answer = FALSE;
    
    printf("Enter 2 numbers: ");
    scanf("%hd%hd", &num1, &num2);

    for (temp_num1 = num1, temp_num2 = num2; temp_num1 && !answer;
        (!temp_num2) ?
        temp_num2 = num2, temp_num1 /= TEN:
        (temp_num1 % TEN == temp_num2 % TEN) ?
        answer = TRUE :
        (temp_num2 /= TEN));

    printf("The answer is: %hu\n", answer);
}