Eine Summe berechnen
Multipliziere die Anzahl der Artikel mit dem Preis pro Artikel, um den Gesamtpreis zu erhalten.
Ein einfaches Beispiel
Am Anfang2 × 3
Ergebnis6
using System;
Console.WriteLine((2 * 3));
6
Anzeigen
Beispiele aus dem Alltag
Drei Notizbücher kosten jeweils 4. Wie viel kosten sie insgesamt?
Am Anfang3 × 4
Ergebnis12
using System;
int notebooks = 3;
int price = 4;
Console.WriteLine((notebooks * price));
12
Beispiel ausführen
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson