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

    Console.Write ("Message" + variable_name); 
    Console.WriteLine("Message" + variable_name); 

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 = "JustTechReview";

 //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 = JustTechReview

Leave a Comment

error: Alert: Content is protected!!