Initial Basics – Algebra – Problem #22

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: Medium

Problem Statement

Write a program to perform the following for a user who wants to purchase wood: i) Ask the user for the type of wood ('n' for natural wood, 's' for synthetic wood). ii) Ask for the weight he wants. iii) Compute and print the base price. iv) Compute and print the GST. v) Compute and print the total price. All prices should have two digits in the decimal place (use %XX.YYf format for this). Assume that price of natural wood is Rs. 1100/kg, that of synthetic one is Rs. 780/kg, and the respective GSTs are 20% and 15% on the base price. Example: Enter the type of wood (n for natural wood, s for synthetic wood): n Enter the weight of wood (in Kg.) you want: 7.25 ------------------------- Base price = 7975.00 GST = 1595.00 Total price = 9570.00 ------------------------- Example Enter the type of wood (n for natural wood, s for synthetic wood): n Enter the weight of wood (in Kg.) you want: 13.12 ------------------------- Base price = 14432.00 GST = 2886.40 Total price = 17318.40 -------------------------

Back to Lab Problems
Initial Basics/Algebra/Problem #22

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #22

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.