Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Primitive Data Types and Variables . a, Declare five variables choosing for each

ID: 3568432 • Letter: P

Question

Primitive Data Types and Variables

.

a, Declare five variables choosing for each of them the most appropriate of the types byte, sbyte, short, ushort, int, uint, long, ulong to represent the following values: 52130, -115, 4825932, 97, -10000.

.

b, Which of the following values can be assigned to a variable of type float and which to a variable of type double: 34.567839023, 12.345, 8923.1234857, 3456.091?

.

c, Write a program that safely compares floating-point numbers with precision of 0.000001.

.

d, Declare an integer variable and assign it with the value 254 in hexadecimal format. Use Windows Calculator to find its hexadecimal representation.

.

e, Declare a character variable and assign it with the symbol that has Unicode code 72. Hint: first use the Windows Calculator to find the hexadecimal representation of 72.

.

f, Declare a boolean variable called isFemale and assign an appropriate value corresponding to your gender.

.

.

.

You can upload the anwer online we i can run it and give the link here...u can use this link or any other .....www.wikisend.com

.

Explanation / Answer

a,

using System;

class Program
{
static void Main()
{
ushort usVar = 52130; /* min. 0 | max. 65535 */
sbyte sbVar = -115; /* min. -128 | max. 127 */
uint uiVar = 4825932u; /* min. 0 | max. 4294967295 */
byte bVar = 92; /* min. 0 | max. 255 */
short sVar = -1000; /* min. -32768 | max. 32767 */

/* Print the numbers on the console */
Console.WriteLine("ushort example: " + usVar);
Console.WriteLine("sbyte example: " + sbVar);
Console.WriteLine("uint example: " + uiVar);
Console.WriteLine("byte example: " + bVar);
Console.WriteLine("short example: " + sVar + Environment.NewLine);
}
}

b,

using System;

class Program
{
static void Main()
{
double number1 = 34.567839023; /* 15-16 digits */
float number2 = 12.345f; /* 7 digits */
double number3 = 8923.1234857;
float number4 = 3456.091f;

/* Print the numbers on the console */
Console.WriteLine("Example of double: " + number1);
Console.WriteLine("Example of float: " + number2);
Console.WriteLine("Example of double: " + number3);
Console.WriteLine("Example of float: " + number4 + Environment.NewLine);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote