#include <stdio.h>

#define TEN 10
#define ZERO 0
//---------------------------------------------------------------------------------------
//                                              Exercise 2
//                                              ----------
//
// General : The program change order digits - reverse order.
//
// Input   : Number with 3 digits.
//
// Process : The program take the digits from right to left and multiplier the digit 
//           by 10.
//
// Output  : Same number like input just reverse order.
//
//---------------------------------------------------------------------------------------
// Programmer : Cohen Idan
// Student No : None
// Date       : 09.09.2019
//---------------------------------------------------------------------------------------
void main(void)
{
    short num,
    temp,
    result = ZERO;

    printf("Enter number with 3 digits: ");
    scanf("%hd", &num);

    // Take the first digit from right to left and add to result
    temp = num / TEN;
    result += num - (temp * TEN);
    num = temp;

    temp = num / TEN;

    // Multiplie the result by 10
    result *= TEN;
    result += num - (temp * TEN);
    num = temp;

    temp = num / TEN;
    result *= TEN;
    result += num - (temp * TEN);

    printf("%hd\n", result);
}