Daily Challenge #86

Today’s challenge will be easy procedure (again :sweat_smile: ).
A shop is doing a promotion on an item with the price of $a. Every x item bought, the total price not including the remainder* will reduce by y%. But there is a limit. The reduction can’t be higher than z%. You are gonna buy n item.
*If there is remainder, the remain items will not have reduction. (like when you buy 7 items but only every 3 items, only 6 items prices will be reduced.)

Your task is to return the percentage reduced, and how much is needed to pay.
5 inputs in total

For example,
Input: a=10, x=2, y=5, z=50, n=12

Output:
The percentage reduced: 30% off
Money needed to pay: $84

Input: a=8.1, x=3, y=7, z=20, n=15

Output:
The percentage reduced: 20%
Money needed to pay: 97.2

Good Luck!

1 Like

Whoah! Nice and tricky DC! Can’t try to figure it out now, but will definately later! Hope today someone else than me also gets in here!

Yoshi

1 Like

Attention to this.

1 Like

So the result should it be like this or not ?

1 Like

@dora_paz correct! Mind to show yohr blocks?

Here is my solution but I don’t think is the best or the correct one

a lot of blocks :slight_smile:

My blocks

1 Like

You can join text in the result slot instead of in all if condition. You can save a lot of blocks

1 Like

I know :crazy_face: ! I’m bloc-a-holic !

2 Likes

actually, the only way to do it is to use math operation. So that’s great, tho.

Since it is almost 24h, let me post my solution.

My solution

1 Like

Btw, would you mind to tell me the total number of blocks?

You should make it a daily challenge, solving a problem with max blocks used :crazy_face: :rofl:

141 blocks :stuck_out_tongue_winking_eye:

2 Likes

You give me an idea of the next challenge. :grin:
But I think I will wait a few days, cuz these days it is just me to make challenges.
Maybe @dora_paz you can try to make one :slight_smile:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.