Advertisement
skipter

C# Increasing Elements in Array

Jun 23rd, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. namespace _13.IncrsingElmInArray
  4. {
  5.     class Program
  6.     {        
  7.         static void Main(string[] args)
  8.         {
  9.            int[] arrayElements = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  10.  
  11.             bool IsIncreasing = false;
  12.             for (int cnt = 0; cnt < arrayElements.Length - 1; cnt++)
  13.             {
  14.                 if (IsIncreasing = arrayElements[cnt] < arrayElements[cnt + 1])
  15.                 {
  16.                     IsIncreasing = true;
  17.                 } else
  18.                 {
  19.                     IsIncreasing = false;
  20.                     break;
  21.                 }                
  22.             }
  23.             if (IsIncreasing)
  24.             {
  25.                 Console.WriteLine("Yes");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine("No");
  30.             }
  31.         }        
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement