#include "General.h" //--------------------------------------------------------------------------------------- // SumDiffDigits // ------------------- // // General : Checks the sum of digits in the absolute value. // // Parameters : // num1 - first number (int) // num2 - second number (int) // // Return value : The Checks the sum of digits in the absolute value. (unsigned short). // //--------------------------------------------------------------------------------------- // Programmer : Cohen Idan // Student No : 211675038 // Date : 30.12.2019 //--------------------------------------------------------------------------------------- unsigned short SumDiffDigits(int num1, int num2) { if (num1 < TEN && num2 < TEN) return (ABS(num1 - num2)); else return (SumDiffDigits(num1 / TEN, num2 / TEN) + ABS((num1 % TEN) - (num2 % TEN))); } void main(void) { printf("%hu\n", SumDiffDigits(7890, 453)); }