GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 14 August 2022

[Solution] Sale Season CodeChef Solution | Solution CodeChef


Problem

It's the sale season again and Chef bought items worth a total of X rupees. The sale season offer is as follows:

  • if X \le 100, no discount.
  • if 100 \lt X \le 1000, discount is 25 rupees.
  • if 1000 \lt X \le 5000, discount is 100 rupees.
  • if X \gt 5000, discount is 500 rupees.

Find the final amount Chef needs to pay for his shopping.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

  • Each test case consists of single line of input containing an integer X.

Output Format

For each test case, output on a new line the final amount Chef needs to pay for his shopping.

Explanation:

Test case 1: Since X \le 100, there is no discount.

Test case 3: Here, X = 250. Since 100 \lt 250 \le 1000, discount is of 25 rupees. Therefore, Chef needs to pay 250-25 = 225 rupees.



No comments:

Post a Comment