diff --git a/Basic/Reverse A String/SolutionByGurirath.java b/Basic/Reverse A String/SolutionByGurirath.java new file mode 100644 index 000000000..67151893b --- /dev/null +++ b/Basic/Reverse A String/SolutionByGurirath.java @@ -0,0 +1,26 @@ +import java.util.*; + +public class SolutionByGurirath { + + public static void main(String args[]) { + + String x, y = ""; + + Scanner kb = new Scanner(System.in); + + System.out.print("Enter a String to be reversed"); + + x = kb.nextLine(); + + int n = x.length(); + + for (int i = n - 1; i >= 0; i--) { + + y = y + x.charAt(i); + + } + System.out.println("The reversed String is:"+y); + + } + +}