Monday, June 24, 2013

Write a program to print string without any special character?

Problem:
You have to print the given string without any special character , example  string CO#M&*PUT^ER should be printed as COMPUTER

Sloution:

#include<stdio.h>
#include<conio.h>

void main()
{
char a[100],i,j;
clrscr();
printf("\nenter the string without space");
scanf("%s",a);
for(i=0;a[i]!='\0';i++);
for(j=0;j<i;j++)
if((a[j]>='a'&&a[j]<='z')||(a[j]>='A'&&a[j]<='B'))
printf("%c",a[j]);
getch();
}

Output:


Like the Post? Do share with your Friends.

No comments:

Post a Comment