Calculate a total
Multiply the number of items by the price of one item to get the total.
Simple example
Start2 × 3
Result6
using System;
Console.WriteLine((2 * 3));
6
Advertisements
Everyday examples
Three notebooks cost 4 each. What is the total?
Start3 × 4
Result12
using System;
int notebooks = 3;
int price = 4;
Console.WriteLine((notebooks * price));
12
Run the example
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson