How to print an array of strings using for reverse loop in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] arr = { "c#", "c", "c++", "java", "python" };

            for (int i = arr.Length - 1; i >= 0; i--)
            {
                Console.WriteLine(arr[i]);
            }
        }
    }
}


/*
run:
    
python
java
c++
c
c#
  
*/

 



answered Feb 10, 2017 by avibootz

Related questions

2 answers 250 views
1 answer 172 views
1 answer 148 views
2 answers 257 views
1 answer 176 views
1 answer 111 views
111 views asked Jan 14, 2024 by avibootz
...