Increasing, Decreasing & Bouncy Numbers | ISC Computer Science 2023 Paper 2
Increasing, Decreasing & Bouncy Numbers | ISC Computer Science 2023 Paper 2
An integer whose digits are arranged in ascending order from left to right is called an increasing number. At any position, the current digit is always greater than or equal to the previous digit. For example, 1233, 13689, 112334566, etc.
An integer whose digits are arranged in descending order from left to right is called a decreasing number. Here, the current digit is always less than or equal to the previous digit. For example, 321, 88531, 8755321, etc.
A positive integer where the digits are neither in increasing nor decreasing order is called a bouncy number. In other words, if the digits of the number are unsorted, then it is bouncy. For example, 123742, 101, 43682, etc.
Design a program to accept a number (containing only digits 0 to 9) from the user. For an invalid input, display an appropriate message. Check whether the number is an increasing, decreasing or a bouncy number and display with an appropriate message in the format specified below:
Example 1
INPUT: Enter a number: 122344
OUTPUT: 122344 IS AN INCREASING NUMBER
Example 2
INPUT: Enter a number: 887552
OUTPUT: 887552 IS A DECREASING NUMBER
Example 3
INPUT: Enter a number: 185349
OUTPUT: 185349 IS A BOUNCY NUMBER
Example 4
INPUT: Enter a number: 98#57-649
OUTPUT: INVALID INPUT
#bouncy #increasing #decreasing #computerscience #isc #java