#include<stdio.h>
#include<conio.h>
#include<string.h>
char altcase(char *p);
void main()
{
char str[20];
clrscr();
printf(" \n \n Enter the string: \t ");
gets(str);
altcase(str);
getch();
}
char altcase(char *p)
{
printf(" \n \n Alternate characters of string are: \t ");
while(*p)
{
if (*p >= 'A' && *p <= 'Z')
{
*p = *p + 32;
}
else if (*p >='a' && *p <='z')
{
*p = *p - 32;
}
printf("%c",*p);
p += 2;
}
return 1;
}
OUTPUT:
Enter the string: LnTInfotech
Alternate Characters of string are: L T n o e h
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.
realy. GIET GUNUPUR ROCKS
ReplyDelete