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 static bool checkDigits(int num) { bool ascending = true; while (num > 10) { int onesDigits = num % 10; int tensDigits = (num / 10) % 10; if (onesDigits < tensDigits) { ascending = false; return ascending; } num = num / 10; } return ascending; }

Questions about programming?Chat with your personal AI assistant