Lucky Pairs   Richie and Raechal are participating in a game called "Lucky pairs" at the Annual Game Fair in their Company. As per the rules of the contest, two members form a team and Richie initially has the number A and Raechal has the number B. There are a total of N turns in the game, and Richie and Raechal alternatively take turns. In each turn, the player's number is multiplied by 2. Richie has the first turn. Suppose after the entire N turns, Richie’s number has become C, and Raechal’s number has become D, the final score of the team will be the sum of the scores (C+D) of both the players after N turns.   Write a program to facilitate the quiz organizers to find the final scores of the team.   Input and Output Format: The only line of input contains 3 integers A, B, and N. Output a single line that contains the integer that gives the final score of the team which will be the sum of the scores of both the players after N turns. Refer sample input and output for formatting specifications. Sample Input 1: 1 2 1 Sample Output 1: 4 Sample Input 2: 3 7 2 Sample Output 2: 20

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question
Lucky Pairs
 

Richie and Raechal are participating in a game called "Lucky pairs" at the Annual Game Fair in their Company. As per the rules of the contest, two members form a team and Richie initially has the number A and Raechal has the number B.
There are a total of N turns in the game, and Richie and Raechal alternatively take turns. In each turn, the player's number is multiplied by 2. Richie has the first turn. Suppose after the entire N turns, Richie’s number has become C, and Raechal’s number has become D, the final score of the team will be the sum of the scores (C+D) of both the players after N turns.
 
Write a program to facilitate the quiz organizers to find the final scores of the team.
 
Input and Output Format:

The only line of input contains 3 integers AB, and N.
Output a single line that contains the integer that gives the final score of the team which will be the sum of the scores of both the players after N turns.
Refer sample input and output for formatting specifications.

Sample Input 1:
1 2 1
Sample Output 1:

4

Sample Input 2:
3 7 2

Sample Output 2:
20

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole