File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace Algorithms . Strings ;
4
+
5
+ public static class ReversedString
6
+ {
7
+ //comment
8
+ // In this Main Method we are taking the input and calling ReverseString Method which will return reversedString and we will print in main Method
9
+ //comment
10
+ public static void Main ( string [ ] args )
11
+ {
12
+ // Sample Input : "reverse"
13
+ // Sample Output : "esrever"
14
+ string input = Console . ReadLine ( ) ;
15
+ string reversedString = ReverseString ( input . Trim ( ) ) ;
16
+ Console . WriteLine ( reversedString ) ;
17
+ }
18
+
19
+ //comment
20
+ // This Method will take input as string and return the reversed string
21
+ //comment
22
+
23
+ public static string ReverseString ( string input )
24
+ {
25
+ string reverseString = "" ;
26
+ int length = input . Length ;
27
+ while ( length != 0 )
28
+ {
29
+ reverseString = reverseString + input [ length - 1 ] ;
30
+ length -= 1 ;
31
+ }
32
+ return reverseString ;
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments