Google Search

Sunday, October 30, 2011

C PROGRAM TO READ A STRING AND WRITE IT IN REVERSE ORDER



PROGRAM TO READ A STRING AND WRITE IT IN REVERSE ORDER

#include<stdio.h>
#include<conio.h>
void main()
{
char a[20],i , b[20],g=0,j;
clrscr();
printf("Enter any string: ");
scanf("%s",a);
for(i=0;a[i]!='\0';i++)
{
g++;
}
j=g-1;
for(i=0;i<g;i++)
{
b[j]=a[i];
j--;
}
printf("Reverse order  of string: %s",b);
getch();
}

1 comments:

Post a Comment