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

Console.WriteLine and Write methods in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print a line with a new line at the end.

C Sharp (C#)
Console.[1]("Hello, world!");
Drag options to blanks, or click blank then click option'
AWrite
BPrintLine
CPrint
DWriteLine
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write instead of WriteLine when a new line is needed.
2fill in blank
medium

Complete the code to print text without moving to a new line.

C Sharp (C#)
Console.[1]("Hello, ");
Console.WriteLine("world!");
Drag options to blanks, or click blank then click option'
AWriteLine
BPrint
CWrite
DPrintLine
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine when you want to continue printing on the same line.
3fill in blank
hard

Fix the error in the code to print two lines correctly.

C Sharp (C#)
Console.[1]("First line");
Console.[1]("Second line");
Drag options to blanks, or click blank then click option'
APrintLine
BWriteLine
CPrint
DWrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using Write which does not add a new line, causing lines to run together.
4fill in blank
hard

Fill both blanks to print numbers 1 to 3 on the same line separated by spaces.

C Sharp (C#)
for (int i = 1; i <= 3; i++)
{
    Console.[1](i + " ");
}
Console.[2]();
Drag options to blanks, or click blank then click option'
AWrite
BWriteLine
CWriteLine()
DWrite()
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine inside the loop causing each number to print on a new line.
5fill in blank
hard

Fill all three blanks to print a greeting with a name on the same line.

C Sharp (C#)
string name = "Alice";
Console.[1]("Hello, ");
Console.[2](name);
Console.[3]("!");
Drag options to blanks, or click blank then click option'
AWriteLine
BWrite
CWriteLine()
DWrite()
Attempts:
3 left
💡 Hint
Common Mistakes
Using WriteLine which moves to a new line after each print.