/* STRING REVERSE WITHOUT USING LIBRARY FUNCTION */
#include<stdio.h>
#include<conio.h>
main()
{
char str[30];
int i,count=0;
clrscr();
printf("\n Enter a string: ");
gets(str);
for(i=0; str[i]!='\0'; i++)
{
count=count+1;
}
printf("\n The given string after reverse = ");
for(i=count-1; i>=0; i--)
{
printf("%c",str[i]);
}
getch();
}
No comments:
Post a Comment