netoops blog

Saturday, 24 August 2013

Anagram

#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();
}

Tech Knowledege
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments :

Post a Comment

 
Subscribe For Free Updates!

We'll not spam mate! We promise.

Become Our Fan on Social Sites!