byte
The byte keyword denotes an integral type that stores values from 0 to 255. The size of the data type byte is 8 bits.
The byte keyword denotes an integral type that stores values from 0 to 255. The size of the data type byte is 8 bits.
You can declare and initialize a byte variable like this example:
byte a = 0;
Proposed Exercise: The first byte variable
Create a program in C# to declare a variable of type byte. Initializes the variable to 255 and shows the value of the variable display.
using System; class FirstByteVariable { static void Main() { byte a; a = 255; Console.Write(a); } }
Proposed Exercise: Store age of person
Develop a program in C# to store the user´s age into a variable 'a' and I replied 'You seem less than a'.
using System; class StoreAgePerson { static void Main() { byte a; a = byte.Parse( Console.ReadLine() ); Console.WriteLine("You seem less than " + a); } }