Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /*
- =====================================================
- chapter 5: Arrays
- Ex2: ascending Array
- =====================================================
- */
- public class MyProgram {
- public static void main(String[] args) {
- final int SIZE=5;
- int arr[]=new int[SIZE];
- boolean isSequence =true;
- Scanner s=new Scanner(System.in);
- for(int i=0;i<arr.length;i++){
- arr[i]=s.nextInt();
- }
- for(int i=1;i<arr.length;i++){
- if(arr[i-1]>=arr[i]){
- System.out.println("NOT Sequence");
- isSequence=false;
- break;
- }
- }
- if(isSequence)
- System.out.println("Sequenced Array!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment