1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include<stdio.h> int main(){ char str1[20], str2[20]; int i=0, c=0; printf("Enter the 1st string:\n"); gets(str1); printf("Enter the 2nd string:\n"); gets(str2); while((str1[i]!='\0') || (str2[i]!='\0')){ if(str1[i]!=str2[i]) c++; i++; } if(c==0) puts("Strings are equal"); else puts("Strings are not equal"); return 0; } |
Sample Input
Enter the 1st string:
India
Enter the 2nd string:
INdia
Sample Output
Strings are not equal