Write a program that plays a word game with the user The pro

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!





Solution

#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);

}

 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
 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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site