#include <stdio.h>
#include <conio.h>
main()
{
char str1[100],str2[100];
int i,k;
clrscr();
gotoxy(15,2);
printf("Program on String Comparison\n");
gotoxy(5,5);
printf("Enter String1 : ");
gets(str1);
gotoxy(5,7);
printf("Enter String2 : ");
gets(str2);
gotoxy(5,9);
/* Comparison procedure */
for(i=0;(str1[i]==str2[i])&&str1[i]!='\0'&&str2[i]!='\0';i++);
if (str1[i]=='\0'&&str2[i]=='\0')
puts("Entered Strings are same");
else
puts("Entered Strings are not same");
getch();
}
No comments:
Post a Comment