Canna

Saturday, 15 June 2019

REVERSE STRING

  • Problem Description

    Reverse String using Pointers in C
  • Test Case 1

    Input (stdin)
    Cse
    
    
    Expected Output
    esC
  • Test Case 2

    Input (stdin)
    Department
    
    
    Expected Output
    tnemtrapeD
  • Program
  • #include <stdio.h>
    #include <string.h>
    int main()
    {
      char str[100];
      int i,len;
      scanf("%s",str);
      len=strlen(str);
      for(i=len-1;i>=0;i--)
       printf("%c",str[i]); 
      
      
      
      return 0;
    }
      
      
    
     
    
    
    
    
    

No comments:

Post a Comment

Note: only a member of this blog may post a comment.