Q:

Write a program in C# Sharp to print individual characters of the string in reverse order

0

Write a program in C# Sharp to print individual characters of the string in reverse order.
Test Data :
Input the string : nerdutella.com
Expected Output :

The characters of the string in reverse are : 

m  o  c  .  r o o f a a d

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise4
{  
    public static void Main() 
        {
            string str; 
            int l=0;	
      Console.Write("\n\nprint individual characters of string in reverse order :\n");
      Console.Write("------------------------------------------------------\n"); 	
      Console.Write("Input the string : ");
      str = Console.ReadLine();	  
      l = str.Length - 1;
	  Console.Write("The characters of the string in reverse are : \n");
            while (l >= 0)
            {
                Console.Write("{0} ", str[l]);
                l--;
            }
                Console.Write("\n\n");
        }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now