31 lines
985 B
C
31 lines
985 B
C
#include "General.h"
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// DiffCountDigits
|
|
// ---------------
|
|
//
|
|
// General : Check the count of digit difference between two numbers.
|
|
//
|
|
// Parameters :
|
|
// num1 - first number (int)
|
|
// num2 - second number (int)
|
|
//
|
|
// Return value : The count of digit difference between two numbers (unsigned short).
|
|
//
|
|
//---------------------------------------------------------------------------------------
|
|
// Programmer : Cohen Idan
|
|
// Student No : 211675038
|
|
// Date : 30.12.2019
|
|
//---------------------------------------------------------------------------------------
|
|
unsigned short DiffCountDigits(int num1, int num2)
|
|
{
|
|
if (num1 == ZERO && num2 == ZERO)
|
|
return (ZERO);
|
|
else
|
|
return ((DiffCountDigits(num1 / TEN, num2 / TEN)) + (num1 == ZERO || num2 == ZERO));
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
|
|
} |