@Mike When I am running the below program, output is coming in different lines. can you please advise what changes to make in the program ? Thanks // using fgets() instead of scanf() char color[50]; char pluralNoun[50]; char celebrity[50]; printf("Enter color: "); fgets(color, 50, stdin); printf("Enter plural noun: "); fgets(pluralNoun, 50, stdin); printf("Enter celebrity: "); fgets(celebrity, 50, stdin); printf("Roses are %s ", color); printf("%s are blue ", pluralNoun); printf("I love %s ", celebrity);
@elliottshea61595 жыл бұрын
Since fgets stores the enter key that you use to submit the variable, it outputs a new line with the final output.