Write a Program to Print the Given String in Reverse Order 

C++// C++ Program to reversea string #include <cstring> #include <iostream> using namespace std; int main() { int len; string str = "GeeksforGeeks"; len = str.size(); cout << "Reverse of the string: "; for (int i = len - 1; i >= 0; i--) { cout << str[i]; } cout << endl; return 0; }

Output

Reverse of the string: skeeGrofskeeG

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *