fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main() {
  6. char str[10],rev[10];
  7.  
  8. int i,j,k;
  9. printf("enter the string \n");
  10. scanf("%s",str);
  11. for(i=0;str[i]!='\0';i++)
  12. ;
  13. k=i-1;
  14. for(j=0;j<=i-1;j++)
  15. {
  16. rev[j]=str[k];
  17. k--;
  18. }
  19. rev[j]='\0';
  20. printf("reverse=%s",rev);
  21. return 0;
  22. }
Success #stdin #stdout 0s 3300KB
stdin
abcdef
stdout
enter the string 
reverse=fedcba