Code Logo

Calculate Laundry Cost

Published at19 Apr 2026
Easy 0 views
Like0

This problem is based on a simple laundry payment. A laundry shop charges customers based on how many kilograms of clothes they bring in.

You are given the clothing weight and the price per kilogram. Your task is to calculate the final total cost.

For example, if the weight is 6 kilograms and the price is 4 per kilogram, the answer is 24.

So the task is to multiply the laundry weight by the price per kilogram and return the result.

Example Input & Output

Example 1
Input
weight = 3, price_per_kg = 5
Output
15
Explanation

Multiply the weight by the price per kilogram.

Example 2
Input
weight = 6, price_per_kg = 4
Output
24
Explanation

6 kilograms at 4 per kilogram gives a total of 24.

Example 3
Input
weight = 0, price_per_kg = 7
Output
0
Explanation

No laundry weight means no cost.

Algorithm Flow

Recommendation Algorithm Flow for Calculate Laundry Cost
Recommendation Algorithm Flow for Calculate Laundry Cost

Solution Approach

A simple way to solve this is to use multiplication.

First, read the clothing weight and the price per kilogram. Then multiply those two values together.

The formula is:

total <- weight * price_per_kg

That gives you the full laundry bill.

Once you have the result, print it as the answer.

The logic is short because the total comes from one direct calculation.

Best Answers

Solutions Coming Soon

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