C program to reverse the given word using string

#include<stdio.h>
#include<string.h>

int main()
 {
   char str[100], rev;
   int i=0,c,j;
   printf("Enter the string :\n");
   gets(str);
   j = strlen(str)-1;
   while (i < j)
   {
  rev = str[i];
      str[i] = str[j];
      str[j] = rev;
      i++;
      j--;
   }

   printf("\nReverse string is\n%s",str);
   return 0;
}

OUTPUT

C program to reverse the given word using string

Comments

Popular posts from this blog

C Program for SCAN Disk Scheduling Algorithm | C Programming

C program to Find Cartesian Product of Two Sets | C programming

C Program To Check The String Is Valid Identifier Or Not | C Programming