Initial Basics – Algebra – Problem #13

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

Difficulty: hard

Problem Statement

Write a program that manages transactions in a snacks bar. The program should do the following:  The program first displays a header line: Following are 12 items and their rates (INR): Then it skips a line and prints a menu on the console, as shown below. [3]  Next, the program skips a line and prints: Enter the Serial Number (SN) of item and the quantity you want: The user will enter two valid integers in response, the first being the SN and the second its quantity. [1]  After the user’s input, the program displays the item name and the quantity requested. After that, it computes the payable amount and displays the calculation. The basic price is the rate of the item times the quantity. The tax is 12.5% of the basic price. The payable amount is the sum of the basic price and the tax, rounded to its nearest integer (e.g., 10.49 is rounded to 10, while 10.50 or 10.60 is rounded to 11). Finally, the program prints a greeting. [6] Everything printed should exactly match the output given below, including alignments, justifications, precision of the fractions, the horizontal lines, the greeting, etc. You may assume that the total amount (before rounding) is less than INR 9999.50.

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

Lab Problem Statement

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

Interactive C Compiler · Problem #13

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.