Monday, 8 December 2014

Program to print a string
#include<stdio.h>
#include<string.h>
main()
{
char str[50];
int i;
printf("enter a string\n");
scanf("%[^\n]s",str);
for(i=0;str[i];i++)
{
if(!((str[i]>='A')&&(str[i]<='Z')||(str[i]>='a')&&(str[i]<='z')))
{
strcpy(str+i,str+i+1);
i--;
}
}
printf("string is %s\n",str);
}
OutPut:
madan@madan-Lenovo-G570:~/madan$ ./a.out
enter a string
we34com344 madan
string is wecommadan