Question #252449

Print the two strings, firstString and secondString, in alphabetical order. Assume the strings are lowercase. End with newline. Sample output:


Expert's answer

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

int main()
{
    char firstString[200], secondString[200];
    printf("Input first string:");
    scanf("%s", firstString);
    printf("Input second string:");
    scanf("%s", secondString);
    
    if (strcmp(firstString, secondString) < 0)
        printf("%s %s\n", firstString, secondString);
    else
        printf("%s %s\n", secondString, firstString);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS