Hello Guys! Welcome to my Blog!
Reverse String Array in C#!
Today we will be learn how to reverse a String Arrayit is very simple!
using System;
namespace reverse
{
class Program
{
static void Main(string[] args)
{
string[] names ={"Pogramming","with","imama","guys!" };
for (int j = names.Length-1 ; j>=0; j--)
//it is has been used for minus 1 so that as many times as the loop goes on,the length will continue to be minus and it will come down
{
string print = names[j];//we also print direct names[j]
Console.WriteLine(print);
}
}
}
}
OUTPUT!
guys
imama
with
Programming
Comments
Post a Comment