Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include<stdio.

h>
#include<string.h>
void main()
{
char a[10],b[10];
int e,d,i,j,c=0;
printf("\t\t\t******INPUT******\n");
printf("First Word: ");
scanf("%s",a);
printf("\n");
printf("Second Word: ");
scanf("%s",b);
printf("\n");
e=strlen(a);
d=strlen(b);
printf("\t\t\t******OUTPUT******\n");
if(e==d)
{
for(i=0;a[i]!='\0';i++)
{
for(j=0;b[j]!='\0';j++)
{
if(a[i]==b[j])
{
c++;
}
}
}
if(c==e)
{
printf("%s and %s are anagrams of each other",a,b);
}
else
{
printf("%s and %s are not anagrams of each other",a,b);
}
}
else
{
printf("%s and %s are not anagrams of each other",a,b);
}
}

You might also like