Previous Next
0 / 20
Module DEMO-32-59DEMO-C-32

Daily Sales Calculator using for

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Challenge

You are helping a small coffee and tea shop in Amman, Jordan calculate their total daily sales. Each sale has a price, and your task is to sum up all the sales for the day.

For example, if the shop made 5 sales with prices [1.00 JD, 2.50 JD, 3.00 JD, 4.00 JD, 5.00 JD], the total sales would be 15.50 JD.

Task

Write a program that reads the number of sales and their individual prices, then calculates and prints the total sales for the day in Jordanian Dinars (JD).

Constraints

1 <= n <= 100 Each price is a positive decimal number with up to two decimal places.

Input Format

  • The first line contains an integer n, the number of sales for the day.
  • The next n lines each contain a decimal number representing the price of a single sale.

Output Format

Print a single line containing the total sales for the day, formatted as a decimal number followed by JD (e.g., 7.00 JD).

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3
1.50
2.50
3.00
7.00 JD
Sample #2
Public sample
4
2.00
3.75
1.25
6.00
13.00 JD
Sample #3
Public sample
1
10.50
10.50 JD
Single sale entry
Sample #4
Public sample
6
1.11
2.22
3.33
4.44
5.55
6.66
23.31 JD
Decimal precision test with multiple decimal places
Sample #5
Public sample
3
99.99
0.01
50.00
150.00 JD
Mixed high and low values

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings