Compare

QUESTION

C program to compare two strings\nInput format:\n\nEnter two strings to be compared\n\nOutput format:\nCompare the two strings and print\n\”Entered strings are equal.\” if they are equal else\n \”Entered strings are not equal.\”

ANSWER

#include <stdio.h>
#include<string.h>
int main()
{
  char a[30],b[30];
 scanf("%s%s",a,b);
  if(strcmp(a,b)==0)
    printf("Entered strings are equal.");
  else
     printf("Entered strings are not equal.");
	return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro