Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Exercises_Data_Type_Variables
- {
- class Program
- {
- static void Main(string[] args)
- {
- string firstName = Console.ReadLine();
- string secondName = Console.ReadLine();
- byte age = byte.Parse(Console.ReadLine());
- char sex = char.Parse(Console.ReadLine());
- int personalIdNumber = int.Parse(Console.ReadLine());
- int UEN = int.Parse(Console.ReadLine());
- //
- Console.WriteLine($"First name: {firstName}");
- Console.WriteLine($"Second name: {secondName}");
- Console.WriteLine($"Age: {age}");
- Console.WriteLine($"Gender: {sex}");
- Console.WriteLine($"Personal ID: {personalIdNumber}");
- Console.WriteLine($"Unique Employee number: {UEN}");
- }
- private static void Exchange_Variables_Value()
- {
- var a = 5;
- var b = 10;
- var c = 0;
- Console.WriteLine("Before:");
- Console.WriteLine($"a = {a}");
- Console.WriteLine($"b = {b}");
- Console.WriteLine("After:");
- c = a;
- a = b;
- b = c;
- Console.WriteLine($"a = {a}");
- Console.WriteLine($"b = {b}");
- }
- private static void String_Object()
- {
- string hello = "Hello";
- string world = "World";
- object obj = hello + " " + world;
- string str = (string)obj;
- Console.WriteLine(str);
- }
- private static void Bool_Variable()
- {
- string input = Console.ReadLine();
- var isTrue = Convert.ToBoolean(input);
- if (isTrue)
- {
- Console.WriteLine("Yes");
- }
- else
- {
- Console.WriteLine("No");
- }
- }
- private static void Hexadecimal()
- {
- string data = Console.ReadLine();
- var n = Convert.ToInt32(data, 16);
- Console.WriteLine(n.ToString());
- }
- private static void String_Char()
- {
- string f = "Software University";
- char b = 'B';
- char y = 'y';
- char e = 'e';
- string s = "I love programming";
- Console.WriteLine(f);
- Console.WriteLine(b);
- Console.WriteLine(y);
- Console.WriteLine(e);
- Console.WriteLine(s);
- }
- private static void Floating_Numbers()
- {
- decimal n1 = 3.141592653589793238m;
- double n2 = 1.60217657;
- decimal n3 = 7.8184261974584555216535342341M;
- Console.WriteLine(n1);
- Console.WriteLine(n2);
- Console.WriteLine(n3);
- }
- private static void Integers()
- {
- sbyte num1 = -100;
- byte num2 = 128;
- short num3 = -3540;
- ushort num4 = 64876;
- uint num5 = 2147483648;
- int num6 = -1141583228;
- long num7 = -1223372036854775808;
- //
- Console.WriteLine(num1);
- Console.WriteLine(num2);
- Console.WriteLine(num3);
- Console.WriteLine(num4);
- Console.WriteLine(num5);
- Console.WriteLine(num6);
- Console.WriteLine(num7);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement