Herausforderung: Stringformatierung
Korrigieren Sie den Code, damit die Werte korrekt in den output
-String eingebettet werden.
main.cs
12345678910111213141516using System; internal class Program { static void Main(string[] args) { int num_1 = 10; int num_2 = num_1 * 2; int num_3 = num_2 * 3; int num_4 = num_1 + num_2 + num_3; // Change code below this line Console.WriteLine("The sum of {num_1}, {num_2} and {num_3} is {num_4}"); // Change code above this line } }
Suchen Sie nach fehlenden Symbol(en) in der String-Formatierungssyntax.
main.cs
1234567891011121314151617using System; internal class Program { static void Main(string[] args) { int num_1 = 10; int num_2 = num_1 * 2; int num_3 = num_2 * 3; int num_4 = num_1 + num_2 + num_3; // Change code below this line Console.WriteLine($"The sum of {num_1}, {num_2} and {num_3} is {num_4}"); // Change code above this line } }
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 9
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Awesome!
Completion rate improved to 1.59
Herausforderung: Stringformatierung
Swipe um das Menü anzuzeigen
Korrigieren Sie den Code, damit die Werte korrekt in den output
-String eingebettet werden.
main.cs
12345678910111213141516using System; internal class Program { static void Main(string[] args) { int num_1 = 10; int num_2 = num_1 * 2; int num_3 = num_2 * 3; int num_4 = num_1 + num_2 + num_3; // Change code below this line Console.WriteLine("The sum of {num_1}, {num_2} and {num_3} is {num_4}"); // Change code above this line } }
Suchen Sie nach fehlenden Symbol(en) in der String-Formatierungssyntax.
main.cs
1234567891011121314151617using System; internal class Program { static void Main(string[] args) { int num_1 = 10; int num_2 = num_1 * 2; int num_3 = num_2 * 3; int num_4 = num_1 + num_2 + num_3; // Change code below this line Console.WriteLine($"The sum of {num_1}, {num_2} and {num_3} is {num_4}"); // Change code above this line } }
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 9