From 49d6e1bcedead14adf4caf1a6bd78d5b0d8757ba Mon Sep 17 00:00:00 2001 From: Deborah Gause Date: Sun, 5 Jul 2020 12:07:25 -0400 Subject: [PATCH] Q2 --- assignment_1_group_1/Program.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/assignment_1_group_1/Program.cs b/assignment_1_group_1/Program.cs index 34e0bb0..6eac70d 100644 --- a/assignment_1_group_1/Program.cs +++ b/assignment_1_group_1/Program.cs @@ -4,9 +4,28 @@ namespace assignment_1_group_1 { class Program { + public static string StringReverse(string s) + { + string result = ""; + string temp = ""; + for (int i = s.Length - 1; i >= 0; i--) + { + if (s[i] == ' ') + { + result = temp + " " + result; + temp = ""; + } + else + temp += s[i]; + } + result = temp + " " + result; + + Console.WriteLine(result); + } static void Main(string[] args) { - Console.WriteLine("Hello World!"); + string output = StringReverse("University of South Florida"); + Console.WriteLine(output); } } -} +} \ No newline at end of file