Write a C language program to accept a string from keyboard and display the string in reverse order.


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    char str[100];
    int i, len;
    printf("Enter a String: ");
    scanf("%s",str);
    len=strlen(str);
    printf(" Revers String is: ");
    for(i=len-1;i>=0;i--)
    {
        printf("%c", str[i]);

    }

    getch();
}


Input/Output:
                        Enter a String:  A B C
                        Revers String is: C  B  A

1 comment:

Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....

Theme images by ideabug. Powered by Blogger.