repl.it
@kironroy/

procedural

C#

procedural programming

fork
loading
Files
  • main.cs
  • main.exe
  • notes.txt
main.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
using System;

class MainClass {
    
  public static void Main (string[] args) 
  {
      Console.Write("Whats your name? ");
      var name = Console.ReadLine();
      var reversed = ReverseName(name);
      Console.WriteLine("Reversed name: " + reversed);    
  } 

  public static string ReverseName(string name)
  {
    var array = new char[name.Length];
      for (var i = name.Length; i > 0; i--)
          array[name.Length - i] = name[i -1];

     return new string(array);
     
  }



} // main class bracket