dsavov_02

Симетрични числа

Feb 3rd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int[] numbers = {2,4,4,10,10,4,4,2};
  8. bool isSymmetric = true;
  9.  
  10. for( int i = 0; i < numbers.Length / 2; i++)
  11. {
  12. if (numbers[i] != numbers[numbers.Length - 1 - i])
  13. {
  14. isSymmetric= false;
  15. }
  16. }
  17. if (isSymmetric)
  18. {
  19. Console.WriteLine("Mасивът е симетричен");
  20. }
  21. else
  22. {
  23. Console.WriteLine("Mасивът не е симетричен!");
  24. }
  25. }
  26. }
Add Comment
Please, Sign In to add comment