#include<stdio.h>
#include<conio.h>
#include<string.h>
char realt(char *p);
void main()
{
char str[10];
clrscr();
printf(" \n \n Enter the string: \t ");
gets(str);
realt(str);
getch();
}
char realt(char *p)
{
int i,l;
l = strlen(p);
printf(" \n \n Alternate characters in reverse: \t ");
for(i = l - 1; i >= 0; i -= 2)
{
printf(" %c ",p[i]);
}
return 1;
}
OUTPUT:
Enter the string: pneumonia
Alternate characters in reverse:
a
n
m
e
p
ALSO READ:
Sample C Program To Swap Two Strings Using strcpy() Function.
Sample C Program To Sort A Given Number Of Strings Using strcmp() Function.
Sample C Program To Display Array Of Strings.
Sample C Program To Convert String To An Integer Using atoi() Function.
Sample C Program To Find The Length Of A String.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com