int[] n=new int[5];
for (int i = 0; i < 5; i++)
{
n[i] = i + 100;
}
foreach (int j in n)
{
int i = j - 100;
Console.WriteLine("Element [{0}]={1}", i, j);
i++;
}
namespace ReverseString
{
class Program
{
static void Main(string[] args)
{
string stat = "This is an example of code" +
"This code has written in C#\n\n";
Console.Write(stat);
char[] myArrayofChar = stat.ToCharArray();
Array.Reverse(myArrayofChar);
foreach (char myNewChar in myArrayofChar)
Console.Write(myNewChar); // You just need to write the function
// Write instead of WriteLine
Console.ReadKey();
}
}
}
这是输出:
#C ni nettirw sah edoc sihTedoc fo elpmaxe na si sihT