Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _2015_C_sharp_Exam
- {
- class Program
- {
- /*
- babadel kol element bel moqabel leeh
- ya3ny law 3andy 1 2 3 4 5 , habadel 1 we 5
- ba3deen 2 we 4
- */
- static int[] ReverseArray(int[] arr) //Method that returns an array.
- {
- int size = arr.Length;
- for (int i = 0; i < size / 2; i++)
- {
- int temp = arr[i];
- arr[i] = arr[size - 1 - i];
- arr[size - 1 - i] = temp;
- }
- return arr;
- }
- static void Main(string[] args)
- {
- //Question 2 - b
- int[] arr = { 1, 2, 3, 4, 5 };
- arr = ReverseArray(arr);
- for (int i = 0; i < arr.Length; i++)
- {
- Console.Write(arr[i] + " ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement