-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIncreasing.java
More file actions
35 lines (34 loc) · 891 Bytes
/
Increasing.java
File metadata and controls
35 lines (34 loc) · 891 Bytes
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
import java.util.*;
public class Increasing {
public static void main(String[] args) {
// TODO code application logic here
Scanner s=new Scanner(System.in);
System.out.print("enter n=");
int n=s.nextInt();
int j,i,k;
int[] a=new int[10];
System.out.println("enter the array:");
for(i=0;i<n;i++)
a[i]=s.nextInt();
for( i=0;i<n;i++){
if(a[i]<a[i+1])
break;
}
int c=0,b=0;
System.out.print(i);
for( j=i;j<n;j++){
if(a[j]>a[j+1])
break;
}
System.out.print(j);
for( k=j;k<n;k++ ){
if(a[k]<a[k+1])
break;
}
System.out.print(k);
if(k==n)
System.out.println("true");
else
System.out.println("false");
}
}