Advertisement
AlexJC

Increasing Elements

Aug 27th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace increasing_elemts_2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. int incrElemnts = 0;
  15. int start = 0;
  16. int maxLEnght = 0;
  17.  
  18. for (int i = 1; i <= n; i++)
  19. {
  20. int num = int.Parse(Console.ReadLine());
  21. if (num > start)
  22. {
  23. incrElemnts += 1;
  24. }
  25. else
  26. {
  27. incrElemnts = 1;
  28. }
  29. if (incrElemnts > maxLEnght)
  30. {
  31. maxLEnght = incrElemnts;
  32. }
  33. start = num;
  34. }
  35. Console.WriteLine(maxLEnght);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement