Write a prog to swap even positioned chars with odd positioned chars in a given string.

/**************************************************************/
/*Programmed by : Vivek Patel**********************************/
/*For Bugs Free feel to contact********************************/
/*Website : www.vivekpatel.cjb.net*****************************/
/*Email : vivek_patel9@rediffmail.com**************************/
/**************************************************************/

#include
#include
#include
void main(){
char str[20],tmp;
int i,j;
clrscr();
printf("\nEnter a string : ");
scanf("%s",str);
printf("\n\nOriginal String : %s",str);
for(i=0;i tmp = str[i];
str[i] = str[i+1];
str[i+1] = tmp;
}
printf("\nAfter Swap String : %s",str);
getch();
}



Powered by Wufoo