generate functionThu, 22 Dec 2022

write a function to receive a whole number and return true if the digits are in ascending order from right to left do not use string

public bool IsAscendingOrder(int num) { bool result = true; int remainder = 0; int lastNumber = num % 10; num /= 10; while (num != 0) { remainder = num % 10; if (remainder < lastNumber) result = false; lastNumber = remainder; num /= 10; } return result; }

Questions about programming?Chat with your personal AI assistant