Friday, June 20, 2014

Reversing String

#include<stdio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char name[30];
    int i,j;
    header();
    system("pause");
    system("cls");
    printf("Enter String : ");
    gets(name);
    printf("You have Entered : ");
    for(i=0;name[i]!='\0';i++)
    printf("%c",name[i]);
    printf("\n\n\n");
    for(i=0;name[i]!='\0';i++);
    printf("String Length : %d ",i);
    printf("\n\n\n");
    printf("Reversed String is : ");
    for(j=i;j>=0;j--)
    printf("%c",name[j]);
    printf("\n\n\n");
}

No comments:

Post a Comment