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
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
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Β 9
single

single

Ask AI

expand

Ask AI

ChatGPT

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

Suggested prompts:

Can you explain this in more detail?

What are the next steps I should take?

Can you give me an example?

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Β 9
single

single

some-alt