Question 2: Ali gives pocket money to his son in following fashion. Whatever pocket money is given on first day, next day it becomes double, and in next day it becomes the double of the previous day, and so on. For Example: If on first day 5 rupees are given then on second day 10 rupees will be given and on third it will be 20 rupees. You have to write a C++ Program that asks the number of days for which pocket money is to be given as well as ask the amount of pocket money given on the first day then compute and display the total pocket money. Explanation: Example 1: Enter pocket money on First day: 5 Enter number of days for which pocket money is given: 4 Total pocket money is: 75 75 will be computed as 5+10+20+40 Example 2: Enter pocket money on First day: 2 Enter number of days for which pocket money is given: 7 Total pocket money is: 254 254 will be computed as 2+4+8+16+32+64+128

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Question 2: Ali gives pocket money to his son in following
fashion. Whatever pocket money is given on first day, next
day it becomes double, and in next day it becomes the
double of the previous day, and so on.
For Example:
If on first day 5 rupees are given then on second day 10
rupees will be given and on third it will be 20 rupees.
You have to write a C++ Program that asks the number of
days for which pocket money is to be given as well as ask the
amount of pocket money given on the first day then
compute and display the total pocket money.
Explanation:
Example 1:
Enter pocket money on First day: 5
Enter number of days for which pocket money is given: 4
Total pocket money is: 75
75 will be computed as 5+10+20+40
Example 2:
Enter pocket money on First day: 2
Enter number of days for which pocket money is given: 7
Total pocket money is: 254
254 will be computed as 2+4+8+16+32+64+128
Transcribed Image Text:Question 2: Ali gives pocket money to his son in following fashion. Whatever pocket money is given on first day, next day it becomes double, and in next day it becomes the double of the previous day, and so on. For Example: If on first day 5 rupees are given then on second day 10 rupees will be given and on third it will be 20 rupees. You have to write a C++ Program that asks the number of days for which pocket money is to be given as well as ask the amount of pocket money given on the first day then compute and display the total pocket money. Explanation: Example 1: Enter pocket money on First day: 5 Enter number of days for which pocket money is given: 4 Total pocket money is: 75 75 will be computed as 5+10+20+40 Example 2: Enter pocket money on First day: 2 Enter number of days for which pocket money is given: 7 Total pocket money is: 254 254 will be computed as 2+4+8+16+32+64+128
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY