Don\'t use C++ and alogithm. I want to use C language Write a program that uses
ID: 3609618 • Letter: D
Question
Don't use C++ and alogithm. I want to use C languageWrite a program that uses function strcmp to compare twostrings input by the user. The program should state whether thefirst string is less than, equal to or greater than the secondstring. Don't use C++ and alogithm. I want to use C language
Write a program that uses function strcmp to compare twostrings input by the user. The program should state whether thefirst string is less than, equal to or greater than the secondstring.
Explanation / Answer
please rate - thanks #include #include #include int main() {char s1[20],s2[20]; printf("Enter string 1: "); scanf("%s",&s1); printf("Enter string 2: "); scanf("%s",&s2); if(strcmp(s1,s2)==0) printf("The strings are the same "); else if(strcmp(s1,s2)>0) printf("string 1 is larger thanstring 2 "); else printf("string 2 is largerthan string 1 "); getch(); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.