-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckNumber.java
39 lines (32 loc) · 813 Bytes
/
CheckNumber.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.*;
class CheckNumber{
static boolean checkNumber(int[] array){
boolean flag = false;
for (int j = 0; j < array.length - 1; j++) {
if(array[j] <= array[j + 1])
flag = true;
else{
flag = false;
break;
}
}
return flag;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the number to be checked");
String str = new String(scan.nextLine());
char []newstr = str.toCharArray();
int []ascii = new int[newstr.length];
int i = 0;
for (char ch : newstr) {
ascii[i] = (byte)ch;
i++;
}
boolean bool = checkNumber(ascii);
if(bool == true)
System.out.println("Increasing Number");
else
System.out.println("Not Increasing Number");
}
}