Using Console.WriteLine and Console.Write Methods
📖 Scenario: You are creating a simple console program that displays a greeting message and some information about a product. This will help you learn how to show text on the screen using Console.WriteLine and Console.Write methods.
🎯 Goal: Build a console program that first shows a greeting on one line, then shows product details on the same line using Console.Write, and finally moves to a new line with Console.WriteLine.
📋 What You'll Learn
Create a string variable called
greeting with the value "Hello, welcome!".Create a string variable called
product with the value "Coffee".Create a decimal variable called
price with the value 4.99m.Use
Console.WriteLine to print the greeting variable.Use
Console.Write to print the product variable followed by a space.Use
Console.WriteLine to print the price variable formatted as currency.💡 Why This Matters
🌍 Real World
Console output is used in many simple programs and tools to show messages, results, or instructions to users.
💼 Career
Understanding how to display information clearly on the console is a basic skill for developers working with command-line tools, debugging, or learning programming.
Progress0 / 4 steps