-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
26 lines (24 loc) · 839 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProgram
{
class Program
{
static void Main(string[] args)
{
// Program to reverse a string and print it out
string OldString = "Zebra"; // string which will be reversed
string NewString = ""; // string to hold
// loop over length of chars in string
for (int i = 0; i < OldString.Length; i++)
{
NewString += OldString[OldString.Length-i-1]; // starting at the last index add onto the NewString
}
System.Console.WriteLine(NewString); // output to concole
System.Console.Read(); // Read so as to not close concole
}
}
}