#include <string.h> #include <stdio.h> int main() { int i,flag=0; char str[50],str1[50],ch,ch1; clrscr(); printf("\nEnter the First String : " ); gets(str); printf("\nEnter the Second String : " ); gets(str1); for(i=0; str[i]!='\0'; i++) { ch=str[i]; ch1=str1[i]; if(ch>=97 && ch<=122) { ch-=32; } if(ch1>=97 && ch1<=122) { ch1-=32; } if(ch!=ch1) { flag=1; break; } } if(flag==0) { printf("\n Both Strings %s and %s are Equal ",str,str1); } else { printf("\n Both Strings %s and %s are Not Equal ",str,str1); } return 0; }
OUTPUT:
Enter the First String : Programming9 Enter the Second String : Programming9 Both Strings Programming9 and Programming9 are Equal