reverse the input string


 /* c program to reverse the input string */
#include<stdio.h>
int main()
{
             char s[100];
             char ch;
             int i,j;
             printf("enter the string\n");
             scanf("%c",&ch);
             for(i=0;((ch!='\n')&&(i<99));i++)
            {
                       s[i]=ch;
                       scanf("%c",&ch);
            }
            printf("\nreversed string is:\n");
            for(j=i-1;j>=0;j--)
                      printf("%c",s[j]);
            return 0;
}

sample input and output:
enter the string
programming is fun

reversed string is:
nuf si gnimmargorp