083. Write a program to accept two strings and compare them in C language

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
	char *s1,*s2;
	clrscr();
	printf("Enter string 1 : ");
	scanf("%s",s1);
	printf("Enter string 2 : ");
	scanf("%s",s2);
 
	if(strcmp(s1,s2)>0)
		printf("\nString 1 is greater..");
	else if(strcmp(s1,s2)<0)
		printf("\nString 2 is greater..");
	else
		printf("\nStrings are equal..");
 
	getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *