write a c program to compare two strings s1 and s2.if equal print"equal" otherwise"not equal".note #define com(s1,s2)
#include <stdio.h>
#include<string.h>
#define com(s1,s2) (strcmp(s1,s2) == 0)
int main(void)
{
char string1[1000];
char string2[1000];
printf("Enter string 1: ");
gets(string1);
printf("Enter string 2: ");
gets(string2);
if(com(string1,string2)==1){
printf("equal\n");
}else{
printf("not equal\n");
}
getchar();
getchar();
return(0);
}
Comments
Leave a comment