Advertisement
Tanina80

IncreasingElements

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