using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace reverse_string
{
class Program
{
static void Main(string[] args)
{
char[] a = new char[10];
Console.WriteLine("enter a string(Max 10 char):");
a = Console.ReadLine().ToCharArray();
int len, i;
char temp;
len = a.Length - 1;
for (i = 0; i < a.Length / 2; i++)
{
temp = a[i];
a[i] = a[len];
a[len--] = temp;
}
Console.WriteLine("the ordered array");
for(i=0;i
Console.Write(a[i]);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace reverse_string
{
class Program
{
static void Main(string[] args)
{
char[] a = new char[10];
Console.WriteLine("enter a string(Max 10 char):");
a = Console.ReadLine().ToCharArray();
int len, i;
char temp;
len = a.Length - 1;
for (i = 0; i < a.Length / 2; i++)
{
temp = a[i];
a[i] = a[len];
a[len--] = temp;
}
Console.WriteLine("the ordered array");
for(i=0;i
Console.Write(a[i]);
Console.ReadKey();
}
}
}
No comments:
Post a Comment