C# Program to initialize more than one variable at a time


In this program, You will learn how to initialize more than one variable at a time in C#.


x = y = 10

a = b = 60

Example: How to initialize more than one variable at a time in C#

using System;
public class Test
{
	public static void Main(string[] args)
	{
		int x, y;
		x = y = 7;

		Console.WriteLine("x value is:" + x);
		Console.WriteLine("y value is:" + y);

	}
}

Output:

x value is:7
y value is:7