0
0
C Sharp (C#)programming~15 mins

Arithmetic operators in C Sharp (C#) - Mini Project: Build & Apply

Choose your learning style9 modes available
Arithmetic Operators in C#
📖 Scenario: You are helping a small shop calculate prices and discounts using simple math. You will use arithmetic operators to add, subtract, multiply, and divide numbers.
🎯 Goal: Build a C# program that uses arithmetic operators to calculate the total price, discount amount, and final price after discount.
📋 What You'll Learn
Create variables with exact names and values for prices and discount rate
Use arithmetic operators +, -, *, / correctly
Print the final calculated values exactly as instructed
💡 Why This Matters
🌍 Real World
Calculating prices, discounts, and totals is common in shopping apps and billing systems.
💼 Career
Understanding arithmetic operators is essential for any programming job that involves calculations or data processing.
Progress0 / 4 steps
1
Create initial price variables
Create two double variables called price1 and price2 with values 15.50 and 24.30 respectively.
C Sharp (C#)
Need a hint?

Use double type for decimal numbers and assign the exact values.

2
Add a discount rate variable
Create a double variable called discountRate and set it to 0.10 (which means 10%).
C Sharp (C#)
Need a hint?

Remember to use double and assign the exact value 0.10.

3
Calculate total price and discount amount
Create a double variable called totalPrice that adds price1 and price2. Then create a double variable called discountAmount that multiplies totalPrice by discountRate.
C Sharp (C#)
Need a hint?

Use + to add prices and * to calculate discount.

4
Calculate final price and print results
Create a double variable called finalPrice that subtracts discountAmount from totalPrice. Then print totalPrice, discountAmount, and finalPrice each on its own line using Console.WriteLine.
C Sharp (C#)
Need a hint?

Use - to subtract and Console.WriteLine to print each value on a new line.