147. Program to compare two strings. - Part 2
#include<stdio.h>
char
s1[10],s2[10],i;
void
main()
{
printf("Enter string 1 : ");
scanf("%s",s1);
printf("Enter string 2 : ");
scanf("%s",s2);
for(i=0;s1[i];i++)
{
if(s1[i]!=s2[i])
{
if(s1[i]==s2[i]+32)
continue;
else if(s1[i]+32==s2[i])
continue;
else
break;
}
}
if(s1[i]==s2[i])
printf("Same String \n");
else
printf("Different Strings \n");
}
Comments
Post a Comment