30 lines
800 B
C
30 lines
800 B
C
#include "General.h"
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// MaxDigit
|
|
// --------
|
|
//
|
|
// General : Check the max digit in the number.
|
|
//
|
|
// Parameters :
|
|
// num - number (int)
|
|
//
|
|
// Return value : The max digit in the number (unsigned short).
|
|
//
|
|
//---------------------------------------------------------------------------------------
|
|
// Programmer : Cohen Idan
|
|
// Student No : 211675038
|
|
// Date : 30.12.2019
|
|
//---------------------------------------------------------------------------------------
|
|
unsigned short MaxDigit(int num)
|
|
{
|
|
if (num < TEN)
|
|
return (num);
|
|
else
|
|
return (MAX(MaxDigit(num / TEN), num % TEN));
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
|
|
} |