Write a program that plays a word game with the user. The program should ask the
ID: 3788279 • Letter: W
Question
Write a program that plays a word game with the user. The program should ask the user to enter the following: • His or her name • His or her age • The name of a city • The name of a college • A profession • A type of animal • A pet’s name After the user has entered these items, the program should display the following story, inserting the user’s input into the appropriate locations: There once was a person named NAME who lived in CITY. At the age of AGE, NAME went to college at COLLEGE . NAME graduated and went to work as a PROFESSION . Then, NAME adopted a(n) ANIMAL named PETNAME . They both lived happily ever after!Write a program that plays a word game with the user. The program should ask the user to enter the following: • His or her name • His or her age • The name of a city • The name of a college • A profession • A type of animal • A pet’s name After the user has entered these items, the program should display the following story, inserting the user’s input into the appropriate locations: There once was a person named NAME who lived in CITY. At the age of AGE, NAME went to college at COLLEGE . NAME graduated and went to work as a PROFESSION . Then, NAME adopted a(n) ANIMAL named PETNAME . They both lived happily ever after!
Write a program that plays a word game with the user. The program should ask the user to enter the following: • His or her name • His or her age • The name of a city • The name of a college • A profession • A type of animal • A pet’s name After the user has entered these items, the program should display the following story, inserting the user’s input into the appropriate locations: There once was a person named NAME who lived in CITY. At the age of AGE, NAME went to college at COLLEGE . NAME graduated and went to work as a PROFESSION . Then, NAME adopted a(n) ANIMAL named PETNAME . They both lived happily ever after!
Explanation / Answer
#include<stdio.h>
int main()
{
printf("Enter your name ");
scanf("%s ",name);
printf("Enter your age ");
scanf("%d ",age);
printf("Enter the name of your city ");
scanf("%s ",city);
printf("Enter name of your college ");
scanf("%s ",college);
printf("Enter your profession ");
scanf("%s ",profession);
printf("Enter your pet's type ");
scanf("%s ",animal);
printf("Enter your pet's name ");
scanf("%s ", petname);
printf("There once was a person named %s who lived in %s.At the age of %d, %s graduated and went to work as a %s. Then, %s adopted a %s named %s. They both lived happily ever after!", name,city,age,name,college,name,profession,name,animal,petname);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.