C# Display Variable | How to Display a Variable in Console C#



C# Display Variable

 C# Display Variable
  • Here, the WriteLine () method is used to display variables values to the console window.
  • Use the + character, to combine both text and a variable.

Sample Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Display_Variables
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 5, y = 6, z = 50;
            Console.WriteLine(x + y + z);
        }
    }
}

Output

61

Related Searches to C# Display Variable | How to Display a Variable in Console C#