Question

# Print all the Bouncy numbers in a given range.

### A decreasing number is a non-negative integer in which the digits from left to right are arranged in such a way that no digit on the left is smaller than the digit to its right. For example , 3221

```				```
Enter Lower Range
100
Enter Upper Range
120
Bouncy Numbers between 100 and 120:
101 102 103 104 105 106 107 108 109 1
```
```

# Share code with your friends

Code

```				```
import java.util.Scanner;
public class BouncyNumberInRange
{
public static void main()
{
int temp=0,last=0,digit=0,lowerRange=0,upperRange=0,i=0;
boolean isIncreasing=true,isDecreasing=true;
Scanner sc=new Scanner(System.in);
System.out.println("Enter Lower Range");
lowerRange=sc.nextInt();
System.out.println("Enter Upper Range");
upperRange=sc.nextInt();
System.out.println("Bouncy Numbers between "+lowerRange+" and "+upperRange+":");
for(i=lowerRange;i<=upperRange;i++)
{
//Checking of number being negative is not required
//as it will not enter in while loop if number is negative integer
temp=i;
//This while loop is to check if the number is increasing number
last=temp%10;
while(temp>0)
{
temp=temp/10;
digit=temp%10;
if(last0)
{
isIncreasing=false;
break;
}
last=digit;
}

//This while loop is to check if the number is decreasing number
temp=i;
last=temp%10;
while(temp>0)
{

temp=temp/10;
digit=temp%10;
if(last>digit && temp>0)
{
isDecreasing=false;
break;
}
last=digit;
}
if(isDecreasing==false && isIncreasing==false)
{
System.out.print(i+" ");
}
isIncreasing=true;
isDecreasing=true;
}

}
}

```
```

## Coding Store

Sale ### Mastering String

50
Sale 150
Sale 200
Sale ### Mastering Recursion

50
Sale ### Mastering Numbers

50
Sale ### Mastering Matrix

50
Sale ### Mastering Array

50
Sale ### ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)

50
Sale 50