Question: 2.14.1: Reading and outputting strings. Write a program that reads a person's first and last names separated by a space, assuming the first and last
2.14.1: Reading and outputting strings. Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, comma, first name. End with newline.
Example output if the input is: Maya Jones
Jones, Maya
#include
int main(void) { char firstName[20]; char lastName[20];
printf("Enter first name"); scanf("%s", firstName);
printf(" and last name: "); scanf("%s", lastName);
printf("%s, %s ", lastName, firstName);
return 0; }

Run X Testing with: Maya Jones Output differs. See highlights below. Special character legend Your output Enter first name and last name: Jones, Maya Expected output Jones, Maya X Testing with: Stan Li Output differs. See highlights below. Special character legend Your output Enter first name and last name: Li, Stan Expected output Li, Stan
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
