To print the reverse of a given string using C


Levels of difficulty: / perform operation:

C program to print the reverse of a given string.

C Program

#include <stdio.h>
#include <conio.h>
void main()
{
	char ch[100];
	int i,len;
	clrscr();
	printf("\nENTER A STRING: ");
	gets(ch);
	len=strlen(ch);
	printf("\nTHE STRING IN THE REVERSE ORDER: ");
	for(i=len-1;i>=0;i--)
		printf("%c",ch[i]);
	getch();
}


Output