Skip to content

Commit

Permalink
Create reverse_string_dhanashrisonawane28.cpp
Browse files Browse the repository at this point in the history
Reverse String Program ravya1108#94
  • Loading branch information
dhanashrisonawane28 authored Oct 14, 2023
1 parent 1c13757 commit 8e0e606
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions reverse_string_dhanashrisonawane28.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <iostream>
#include <string>

int main() {
std::string input;
std::cout << "Enter a string: ";
std::cin >> input;

std::string reversed = "";
int length = input.length();

// Reverse the string
for (int i = length - 1; i >= 0; i--) {
reversed += input[i];
}

std::cout << "Reversed string: " << reversed << std::endl;

return 0;
}

0 comments on commit 8e0e606

Please sign in to comment.