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

int num = 123; int n = num; int prev_digit = n % 10; n /= 10; while (n > 0) { int curr_digit = n % 10; if (curr_digit > prev_digit) return false; prev_digit = curr_digit; n /= 10; } return true;

Questions about programming?Chat with your personal AI assistant