+ 1
guys i want to print a string in reverse.. and made a code.. but it's wrong.. please help me to find out the error..
#include <iostream> using namespace std; #include <string> int main() { string s; cin>>s; int n; n=s.length(); for (int n=n;n>=0;n--); cout<<s[n]; return 0; }
8 Answers
+ 1
thank man..
+ 1
use curly bracket except semicolon in for statement
0
it worked
0
but if we use for(int n=n-1;n>=0;n--) why isn't not working
0
ok