Monday, 17 September 2012

Print Even position character


*c program for display character only that are stored in even position*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int i;
 char str[30];
 printf("Enter any string: ");
 gets(str);
 for(i=0; str[i]!='\0'; i++)
 {
   if(i%2==0)
      printf("%c",str[i]);
 }
 getch();
 return 0;
}

No comments:

Post a Comment