Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2022
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace newtasks
  4. {
  5. class Program
  6. {
  7. static public bool isSorted(int[] array)
  8. {
  9. bool sorted = true;
  10. for (int i = 0; i < array.Length - 1; i++)
  11. {
  12. if (array[i] < array[i + 1])
  13. {
  14. continue;
  15. }
  16. else
  17. {
  18. sorted = false;
  19. }
  20. }
  21. return sorted;
  22. }
  23.  
  24. public static void Main(String[] args)
  25. {
  26. int n = int.Parse(Console.ReadLine());
  27. string[] print = new string[n];
  28.  
  29. for (int i = 0; i < n; i++)
  30. {
  31. string[] list = Console.ReadLine().Split(',');
  32. int[] conv = new int[list.Length];
  33. for (int j = 0; j < list.Length; j++)
  34. {
  35. conv[j] = int.Parse(list[j]);
  36. }
  37. print[i] = Convert.ToString(isSorted(conv));
  38. }
  39. foreach(string value in print)
  40. {
  41. Console.WriteLine(value);
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement