ਦੋ ਸਟਰਿੰਗ ਦਾਖਲ ਕਰਕੇ ਉਨ੍ਹਾਂ ਨੁੰ ਕੰਪੇਅਰ ਕਰਨ ਲਈ ਪ੍ਰੋਗਰਾਮ ਲਿਖੋ।

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
    char s1[20], s2[20];
    int r;

    clrscr();
    puts("Enter your first string: ");
    gets(s1);
    puts("Enter your second string: ");
    gets(s2);

    r=strcmp(s1, s2);

    if(r==0)
        printf("Both are same!");
    else
        printf("Not same!");

    getch();
}

Output:

 

Comments