Q:

C# | Declare different types of variables, assign the values and print

belongs to collection: C# Basic Programs | basics

0

C# | Declare different types of variables, assign the values and print

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

/*c# basic program to declare different type of variables and
assigning them with the values and then print the values*/

using System;

class HelloWorld {
	static void Main() {
		//declaring different type of variables and
		//assigning them with the values
		char char_value = 'X';
		int int_value = 100;
		float float_value = 10.23f;
		string string_value = "nerdutella";

		//printing the values
		Console.WriteLine("char_value = " + char_value);
		Console.WriteLine("int_value = " + int_value);
		Console.WriteLine("float_value = " + float_value);
		Console.WriteLine("string_value = " + string_value);
	}
}

Output

char_value = X
int_value = 100
float_value = 10.23
string_value = nerdutella

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | basics

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to demonstrate example of assignment op... >>
<< C# program to demonstrate example of arithmetic op...