I/P
tokona#%!
o/p
!%#tokona
i try this code.....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
string n = "tokonaA#*!";
Console.WriteLine("{0}",n);
int no=n.Length;
int c = 0;
char[] let = n.ToCharArray();
for (int j = no - 1; j >= 0; j--)
{
if (!char.IsLetter(let[j]))
{
Console.Write(let[j]);
}
else if(char.IsLetter(let[j]))
{
Console.Write(let[j]);
}
}
Console.Write("{0}",c);
Console.ReadLine();
}
}
}
but m not get the correct o/p..
so what change i want to do to get the correct o/p
VulpesPosted Aug 31, 2013, 9:12 AM
The output should be:
Posted Aug 31, 2013, 11:03 PM
class Program
{
static void Main(string[] args)
{
Console.Write("I/P is ");
string element = Console.ReadLine();
//Start to retain from 6th index and from 6th index 3 elements are retained
string sub = element.Substring(6, 3);
//ToCharArray() converts strings to character arrays
char[] arr = sub.ToCharArray();
//Reverse the charaters
Array.Reverse(arr);
//Character array is converted into string array
string sArray = new string(arr);
//Removel start from 6th index and balanced is a retained as a string
string result1 = element.Remove(6);
//string array(sArray) is added to retained string
string rearrange = result1.Insert(0, sArray);
Console.WriteLine("O/P is " + rearrange);
Console.ReadKey();
}
}