Code Logo

Check Free Shipping

Published at19 Apr 2026
Easy 0 views
Like0

This problem comes from a very common online shopping rule. A store gives free shipping only when the order total reaches a certain minimum amount.

Your job is to compare the current order total with that minimum. If the total is high enough, print FREE SHIPPING. If it is still below the requirement, print PAY SHIPPING.

For example, if the order total is 120 and the minimum is 100, the answer is FREE SHIPPING. But if the order total is 75 and the minimum is 100, the answer is PAY SHIPPING.

So the task is simply to compare the order amount with the shipping rule and return the correct message.

Example Input & Output

Example 1
Input
total = 100, minimum = 100
Output
FREE SHIPPING
Explanation

Matching the minimum amount is enough to qualify.

Example 2
Input
total = 75, minimum = 100
Output
PAY SHIPPING
Explanation

The order total is still below the required amount.

Example 3
Input
total = 120, minimum = 100
Output
FREE SHIPPING
Explanation

The order total already meets the free shipping rule.

Algorithm Flow

Recommendation Algorithm Flow for Check Free Shipping
Recommendation Algorithm Flow for Check Free Shipping

Solution Approach

A simple way to solve this is to use one comparison.

First, read the order total and the minimum amount needed for free shipping. After that, check whether the order total is greater than or equal to the minimum.

The condition is:

total >= minimum

If that condition is true, the order qualifies, so you print FREE SHIPPING.

If that condition is false, the order has not reached the requirement yet, so you print PAY SHIPPING.

This problem is really just one decision based on two numbers, which is why the logic stays short and clear.

Best Answers

Solutions Coming Soon

Verified best solutions for this Challenge are still being analyzed and will be available soon.