Program to reverse a string


#include<stdio.h>
#include<conio.h>
#include<string.h>

 main()
{
char a[25],temp;
int i,j;
clrscr();

printf("enter the string\n");
gets(a);

i=0;
j=strlen(a)-1;
while(i<j)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
j--;
i++;
}

printf("\n reverse of the string is \n");
puts(a);
getch();
}

0 comments:

Post a Comment