A simple program that will ask the user to give a string and then the program will display the original string and the reverse string on the screen using C programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

#include <stdio.h>
#include <string.h>
 
void reverse_string(char *given_str)
{
    int a=0,temp=0,n=0;
     n=strlen(given_str);
	for(a=0;a<n/2;a++)  
    {
    	temp=given_str[a];
    	given_str[a]=given_str[n-a-1];
    	given_str[n-a-1]=temp;
 
 	}
	  
 }
int main()
{
 
    char str[2000];  
   
    printf("\n\n");
    printf("\tReverse a String in C");
    printf("\n\n");
    printf("\tGive a String: ");
    gets(str);
    
    printf("\n\n");
    printf("\tBefore String Reverse : %s\n",str);
 
    reverse_string(str);
    
	printf("\n\n");
    printf("\tAfter String Reverse  : %s\n",str);
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n\n");
    
     
     
}

Leave a Reply

Your email address will not be published.