Initial Basics – Algebra – Problem #35

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

Difficulty: Medium

Problem Statement

The litres of fuel sold on a day depends on which day of the week it is. Consider Monday as Day 1, Tuesday as Day 2, ....., Sunday as Day 7. Let s be the number litres of fuel sold on a day and v be the number of vehicles sighted on that day across the highway. The number of litres can also be a fraction. (A) For Monday, s is given by one-third of the number of vehicles sighted in the highway across, i.e v (B) For Wednesday, s is 2v/7, rounded off to the nearest lower integer. (C) For Tuesday, Thursday, and Friday, s is v 2 + 2v (D) For the weekends, s is thrice the formula as that used for Tuesday Take the day (1 to 7) and v as input and calculate the amount of fuel sold s on that day, and display it. Also calculate the total price of the fuel sold on that day by assuming that the price of fuel = Rs 120/litre and the GST on the fuel as 25% on the base price. You HAVE to use ‘switch-case’ for this question. Example: (Please take the input and display the output as shown) Input: Day: 3 Vehicles sighted: 100 Output: Fuel sold ‘s’: 28 Total price: 4200 [Reason: 28*120 + 25% GST on (28*120)]

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

Lab Problem Statement

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

Interactive C Compiler · Problem #35

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.