Question: / * This program reads user input from the console and uses it to display formatted output. * / #include #define STR _ LENGTH 5

/*
This program reads user input from the console
and uses it to display formatted output.
*/
#include
#define STR_LENGTH 5
int main(void){
// Char arrays to store the input
char first_name[STR_LENGTH];
char last_name[STR_LENGTH];
int age;
// Prompt user input.
printf("Enter the customer's first name: ");
scanf("%s", first_name);
printf("Enter the customer's last name: ");
scanf("%s", last_name);
printf("Enter the customer's age: ");
scanf("%d", &age);
// Produce the output
printf("
The customer is named: %s %s
", first_name, last_name);
printf("They are %d years old.
", age);
printf("Good bye!");
// A newline char at the end of the output.
putchar('
');
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!