#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[10],str2[10];
char *s1,*s2;
clrscr();
printf ("\nENTER ANY STRING...");
gets(str1);
printf ("\nENTER THE STRING YOU WANT TO CHECK...");
gets(str2);
s1 = str1;
while(*s1)
{
s2 = str2;
while (*s2)
{
if (*s1 == *s2)
{
break;
}
s2++;
}
if (*s2 == '\0')
{
printf ("\nSTRING IS NOT ANAGRAM..");
getch();
exit(0);
}
s1++;
}
printf ("\nSTRING IS ANAGRAM..");
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char str1[10],str2[10];
char *s1,*s2;
clrscr();
printf ("\nENTER ANY STRING...");
gets(str1);
printf ("\nENTER THE STRING YOU WANT TO CHECK...");
gets(str2);
s1 = str1;
while(*s1)
{
s2 = str2;
while (*s2)
{
if (*s1 == *s2)
{
break;
}
s2++;
}
if (*s2 == '\0')
{
printf ("\nSTRING IS NOT ANAGRAM..");
getch();
exit(0);
}
s1++;
}
printf ("\nSTRING IS ANAGRAM..");
getch();
}
0 comments :
Post a Comment