tlon. Suppose you went to a coffee shop and you want to drink some coffee. You decided to drink n cup of coffee, where n is an integer value greater than 0. Now you have to pay m taka for the first...


Please post screenshot of the code and use commands for better understanding thank you .


tlon.<br>Suppose you went to a coffee shop and you want to drink some coffee. You decided to drink<br>n cup of coffee, where n is an integer value greater than 0. Now you have to pay m taka for<br>the first cup of coffee, 2m taka for the second cup, 3m takas for the third cup, and so on. In<br>other words, you have to pay i*m taka for the i-th cup of coffee.<br>Now you have k taka in your pocket. How many takas do you need to borrow from your<br>friend to buy n cup of coffee?<br>The first input in the sample input contains the cost of the first cup of coffee which can be<br>denoted as m. The second input is the number of coffees you want to drink, n. The third<br>input is k, the initial amount of taka you have. You have to calculate how much money you<br>have to borrow from your friend. If you have more or equal amount of money that is needed<br>than print 0.<br>Sample Input 1:<br>3<br>15<br>Sample Output 1:<br>30<br>Explanation 1:<br>Here the price of the first cup of coffee is 3 taka and you want to drink 5 cups of coffee. So<br>you will need a total of 3 + 6 + 9 + 12 + 15 = 45 tk. But you have 15 tk in your pocket. So you<br>have to borrow 45 - 15 = 30 taka from your friend.<br>Sample Input 2:<br>100<br>4<br>1010<br>

Extracted text: tlon. Suppose you went to a coffee shop and you want to drink some coffee. You decided to drink n cup of coffee, where n is an integer value greater than 0. Now you have to pay m taka for the first cup of coffee, 2m taka for the second cup, 3m takas for the third cup, and so on. In other words, you have to pay i*m taka for the i-th cup of coffee. Now you have k taka in your pocket. How many takas do you need to borrow from your friend to buy n cup of coffee? The first input in the sample input contains the cost of the first cup of coffee which can be denoted as m. The second input is the number of coffees you want to drink, n. The third input is k, the initial amount of taka you have. You have to calculate how much money you have to borrow from your friend. If you have more or equal amount of money that is needed than print 0. Sample Input 1: 3 15 Sample Output 1: 30 Explanation 1: Here the price of the first cup of coffee is 3 taka and you want to drink 5 cups of coffee. So you will need a total of 3 + 6 + 9 + 12 + 15 = 45 tk. But you have 15 tk in your pocket. So you have to borrow 45 - 15 = 30 taka from your friend. Sample Input 2: 100 4 1010

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here