Guest User

Untitled

a guest
Mar 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ArrayofElements
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int [] arr = new int[10];
  13. Console.WriteLine("Enter the elements");
  14. for (int i = 0; i < arr.Length; i++)
  15. {
  16. arr[i] = int.Parse(Console.ReadLine());
  17. }
  18. Console.WriteLine("Array Elements are: ");
  19. for (int i = 0; i < arr.Length; i++)
  20. {
  21. Console.Write(" {0} ", arr[i]);
  22. }
  23. Array.Reverse(arr);
  24. Console.WriteLine("\nReversed Array :");
  25. foreach (int i in arr)
  26. {
  27. Console.Write(" {0} ", i);
  28. }
  29. Array.Sort(arr);
  30. Console.WriteLine("\nSorted Array :");
  31. foreach (int i in arr)
  32. {
  33. Console.Write(" {0} ", i);
  34. }
  35. Console.ReadKey();
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment