C# Programming - Hello World - Your First Program (Console Application in C# for Beginners)


C# Programming - Hello World - Your First Program (Console Application in C# for Beginners).

YouTube Video: https://youtu.be/mhEcCpxMoCc

🎓 Master Visual Basic .NET and Access Database By Building the Point Of Sale System (POS).
ðŸ“ē Enroll Now: https://bit.ly/2WcbRhX

Instructions:
Copy the declarations and code below and paste directly into your project.
// .
// .
// .
// .
// . [Source Code]

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
/* Note: Escape Character
* \t = Horizontal Tab
* \n = New Line
* \a = Bell (alert)
*/
string msg1 = "Hello, World!\t\t";
string msg2 = "\t\tWelcome to C# Programming";
printStar(57);
Console.WriteLine("* {0,35} *", msg1);
Console.WriteLine("* {0,28} *", msg2);
printStar(57);
Console.Write("\nEnter your name please: ");
string fname = Console.ReadLine();
Console.WriteLine("\a");
Console.Write("How old are you? ");
int age = Int32.Parse(Console.ReadLine());
Console.WriteLine(".\n.\n.\a");
if (age > 120)
{
Console.WriteLine("\n{0}{1}{2}", "Hello, ", fname, ".");
Console.WriteLine("\n\"{0}\"\n\n{1}{2}{3}", "Age is not valid", "Could humans live to ", age, " years old? \n");
Console.WriteLine("Press any key to Exit. \n\nGood bye. -:)");
Console.ReadKey();
return;
}
else
{
Console.WriteLine("\n{0}{1}{2}", "Hello, ", fname, ".");
Console.WriteLine("\n{0}{1}{2}", "You are ", age, " years old. \n");
Console.WriteLine("Press any key to see your drive information... \n");
Console.ReadKey();
viewDriveInfo();
}
Console.WriteLine("\nPress any key to terminate.\n\a");
// Keep the console window open in debug mode.
Console.ReadKey();
}
public static void viewDriveInfo()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" Drive type: {0}", d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);
Console.WriteLine(" File system: {0}", d.DriveFormat);
Console.WriteLine(" Available space to current user:{0,16} bytes", d.AvailableFreeSpace);
Console.WriteLine(" Total available space: {0,16} bytes", d.TotalFreeSpace);
Console.WriteLine(" Total size of drive: {0,16} bttes \n", d.TotalSize);
}
}
}
public static void printStar(int x)
{
for (int i = 0; i < x; i++)
Console.Write('*');
Console.WriteLine();
// Thanks for watching.
// Please Like Comment Subscribe
// Thank you very much.
}
}
}
// #Csharp #programming
// #ConsoleApplication #CommandPrompt


My Twitter

My Facebook

My Google+

My YouTube Channel

Thank you very much.
āļ‚āļ­āļšāļ„ุāļ“āļ„āļĢัāļš.

Comments