Advertisement
Nabil-Ahmed

Untitled

Jul 26th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     char str1[50], str2[100];
  5.     int res;
  6.      printf("Enter string 1: ");
  7.      gets(str1);
  8.      printf("Enter string 2: ");
  9.      gets(str2);
  10.  
  11.       res=strcmp(str1,str2);
  12.        if(res==0)
  13.        {
  14.            printf("both strings are equal");
  15.        }
  16.        else if(res>-1)
  17.        {
  18.            printf("string 1 is bigger");
  19.        }
  20.        else
  21.        {
  22.            printf("string 2 is bigger");
  23.        }
  24.        return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement