diff --git a/C++/Program-4/README.md b/C++/Program-4/README.md new file mode 100644 index 00000000..e7df3251 --- /dev/null +++ b/C++/Program-4/README.md @@ -0,0 +1,2 @@ +Program -4 +Program to find the reverse of a string diff --git a/C++/Program-4/program.cpp b/C++/Program-4/program.cpp new file mode 100644 index 00000000..9284b32e --- /dev/null +++ b/C++/Program-4/program.cpp @@ -0,0 +1,13 @@ +#include +using namespace std; + +int main() { + string s; + cout<<"Enter the string"<>s; + int n=s.length(); + for (int i = 0; i < n / 2; i++) + swap(s[i], s[n - i - 1]); + cout<