Write a ‘C’ Program to accept a string from user and display the alternate characters


#include<stdio.h>
#include<conio.h>
void main()
{

 char str[20];
int i=0;
 clrscr();

printf("\n enter the string");
scanf("\n %s",str);
  for(i=0;i<strlen(str);i=i+2)
 {
  
   printf("%c",str[i]);
 }

 getch();
}
/* OUTPUT

 enter the string MAHARASHTRA
MHRSTA */