C program to Reverse the string.

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
    char str[100], temp;
    int i=0, j;
    printf("Enter the String: ");
    gets(str);
    i=0;
    j=strlen(str)-1;
    while(i<j)
    {
        temp = str[i];
        str[i] = str[j];
        str[j] = temp;
        i++;
        j--;
    }
    printf("\nReverse of the String is:\n%s", str);
    getch();
    return 0;
}
C program to Reverse the string. C program to Reverse the string. Reviewed by on December 26, 2019 Rating: 5

No comments:

Powered by Blogger.