Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: String Formatting | Dealing with Data Types
C# Basics

bookChallenge: String Formatting

Fix the code so that the values are correctly embedded in the output string.

main.cs

main.cs

copy
12345678910111213141516
using 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 } }

Look for any missing symbol(s) in the string formatting syntax.

main.cs

main.cs

copy
1234567891011121314151617
using 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 } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 9

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

What is the original code that needs fixing?

Can you show me where the values are supposed to be embedded in the output string?

Which programming language is this code written in?

Awesome!

Completion rate improved to 1.59

bookChallenge: String Formatting

Veeg om het menu te tonen

Fix the code so that the values are correctly embedded in the output string.

main.cs

main.cs

copy
12345678910111213141516
using 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 } }

Look for any missing symbol(s) in the string formatting syntax.

main.cs

main.cs

copy
1234567891011121314151617
using 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 } }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 9
some-alt