
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to print one dimensional array in reverse order?
Firstly, declare and initialize one dimensional array.
int[] arr = { 35, 12, 66, 90, 34, 2, 64 };
Now, use the following to reverse −
Array.Reverse(arr);
The following is the complete code to reverse a one-dimensional array;
Example
using System; class Demo { static void Main() { int[] arr = { 76, 12, 66, 90, 34, 2, 64 }; // Initial Array Console.WriteLine("Original Array= "); foreach (int i in arr) { Console.WriteLine(i); } // Reverse Array Array.Reverse(arr); Console.WriteLine("Reversed Array= "); foreach (int j in arr) { Console.WriteLine(j); } Console.ReadLine(); } }
Output
Original Array= 76 12 66 90 34 2 64 Reversed Array= 64 2 34 90 66 12 76
- Related Questions & Answers
- How to sort one dimensional array in descending order using Array Class method?
- How to sort one dimensional array in descending order using non static method?
- How to sort one-dimensional array in ascending order using non-static method?
- How to print the elements in a reverse order from an array in C?
- Python program to print the elements of an array in reverse order
- Split one-dimensional array into two-dimensional array JavaScript
- How to print list values in reverse order using Collections.reverse() in Android?
- Print prime numbers from 1 to N in reverse order
- How to read json array in reverse order in android?
- How to reverse the order of a JavaScript array?
- Difference Between One-Dimensional (1D) and Two-Dimensional (2D) Array
- Java Program to convert array to String for one dimensional and multi-dimensional arrays
- Copying the Queue elements to one-dimensional array in C#
- How to copy the entire ArrayList to a one-dimensional Array in C# ?
- What is a one-dimensional array in C language?
Advertisements