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:
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:
No comments:
Post a Comment