#include<stdio.h>
#include<conio.h>
int main()
{
char s1[100],s2[100];
char c1,c2;
int i,j;
clrscr();
printf("\nEnter first string \n");
gets(s1);
flushall();
printf("\nEnter second string \n");
gets(s2);
i = j = 0;
while ( s1[i] && s2[j] )
{
if ( s1[i] != s2[j])
{
if ( s1[i] >='a' && s1[i] <='z' )
c1= s1[i] - 32;
else
if ( s1[i] >='A' && s1[i] <='Z' )
c1 = s1[i];
if ( s2[j] >='a' && s2[j] <='z' )
c2= s2[j] - 32;
else
if ( s2[j] >='A' && s2[j] <='Z' )
c2 = str2[j];
if ( c1 != c2 )
{
printf("\nThe Strings are not equal");
}
}
i++;
j++;
}
if ( !s1[i] && !s2[j] )
printf("\nThe Strings are equal");
getch();
return 0;
}
No comments:
Post a Comment