Program to print the length and reverse of string in C


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
            char str[20],str1[20],ch;
            int len,i,j;
            clrscr();
            printf("\n Enter the String:-");
            gets(str);
            for(len=0;str[len]!='\0';len++);
            j=0;
            for(i=len-1;i>=0;i--)
            {
            str1[j]=str[i];
            j++;
            }
            str1[j]='\0';
            printf("\nLength=%d\nReverse of String=%s",len,str1);

getch();
}

Output:


About the Author

Unknown

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

Post a Comment

 
My Study Voice © 2015 - Designed by Templateism | Distributed By Blogger Templates