generate functionThu, 22 Dec 2022

write a function to receive a whole number and return the max digit avoid using var

public static int GetMaxDigit(int num) { int max = 0; while (num > 0) { int digit = num % 10; if (digit > max) { max = digit; } num = num / 10; } return max; }

Questions about programming?Chat with your personal AI assistant