Counting Coins – Create a function to calculate the sum of coins, read Input from STDIN and print output to STDOUT

Counting Coins

Problem Statement:

Create a function which can calculate the sum of the total amount of coins, the function should accept four arguments which denotes the number of two rupee coins, five rupee coins, ten rupee coins and hundred rupees as input and return the total values of the each coin and find total amount.

Sample Case 0

Sample Input

1 1 1 1

Sample Output

2
5
10
100
117

Explanation

In this case, we have one 2 rupee coin, one 5 rupee coin, one 10 rupee coin and one 100 rupee coin, so the total amount of coins will be

1 x 2    = 2
1 x 5    = 5
1 x 10   = 10
1 x 100  = 100

and their total sum will be 2 + 5 + 10 + 100 = 117

Sample Case 1

Sample Input

5 10 1 1

Sample Output

10
50
10
100
170

Explanation

In this case, we have five 2 rupee coin, ten 5 rupee coin, one 10 rupee coin and one 100 rupee coin, so the total amount of coins will be

5 x 2    = 10
10 x 5   = 50
1 x 10   = 10
1 x 100  = 100

and their total sum will be 10 + 50 + 10 + 100 = 170

Solution:

Output:

$python counting_coins.py 1 1 1 1
2
5
10
100
117

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.