Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Write a program that asks for 4 names from the user and prints them in rever

ID: 3915057 • Letter: C

Question

C++ Write a program that asks for 4 names from the user and prints them in reverse order. For now, assume that each name consists of a maximum of 20 letters. Because you (maybe) don't yet know about multidimensionalarrays, just use 4 variables. Later you should store data of this kind in a 2D array (or more advanced data type). Your version of the program must print the same result as the expected output. #include <stdio.h> int main() { /* your code */ return 0; } Example input Emma Olivia Noah Liam Example output Liam Noah Olivia Emma

Explanation / Answer

#include int main() { char n1[21], n2[21], n3[21], n4[21]; scanf("%s", n1); scanf("%s", n2); scanf("%s", n3); scanf("%s", n4); printf("%s ", n4); printf("%s ", n3); printf("%s ", n2); printf("%s ", n1); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote