skipter icon

C# Increasing Elements in Array

skipter | PRO | 06/23/17 12:26:10 PM UTC | 0 ⭐ | 365 👁️ | Never ⏰ | []
C# |

880 B

|

None

|

0 👍

/

0 👎

using System;
using System.Linq;
namespace _13.IncrsingElmInArray
{
    class Program
    {        
        static void Main(string[] args)
        {
           int[] arrayElements = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
 
            bool IsIncreasing = false;
            for (int cnt = 0; cnt < arrayElements.Length - 1; cnt++)
            {
                if (IsIncreasing = arrayElements[cnt] < arrayElements[cnt + 1]) 
                {
                    IsIncreasing = true;
                } else
                {
                    IsIncreasing = false;
                    break;
                }                
            }
            if (IsIncreasing)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }        
    }
}

Comments