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

bookChallenge: String Formatting

Task

Swipe to start coding

Your challenge is to practice declaring variables and formatting strings in C#.

  • Declare a string variable named name and assign Alice.
  • Declare an integer variable named age and assign 20.
  • Print a sentence that uses both variables, formatted like this: Hello, my name is Alice and I am 20 years old.
  • Use string formatting to combine the variables and text in the output.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 12
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: String Formatting

Swipe to show menu

Task

Swipe to start coding

Your challenge is to practice declaring variables and formatting strings in C#.

  • Declare a string variable named name and assign Alice.
  • Declare an integer variable named age and assign 20.
  • Print a sentence that uses both variables, formatted like this: Hello, my name is Alice and I am 20 years old.
  • Use string formatting to combine the variables and text in the output.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 12
single

single

some-alt