From 1b1162c5ca8a2d7d446c4f3cfcd00747958d972e Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 16:01:45 +0700 Subject: [PATCH 1/7] Add: program basic part. 1 --- Program.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index fd851a1..034bbd9 100644 --- a/Program.cs +++ b/Program.cs @@ -4,10 +4,15 @@ class Program { static void Main() { + // Output to console basic text Console.WriteLine("Hello World!"); - // See https://aka.ms/new-console-template for more information - Console.WriteLine("Hello, World!"); - var name = Console.ReadLine(); + + // Output get datetime to console Console.WriteLine("Date now: " + DateTime.Now); + + // Input from user + var name = Console.ReadLine(); + // Output to console + Console.WriteLine("Hi, " + name); } } \ No newline at end of file From bc78c3ed149245b7053092e6433907d152808a50 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 16:31:37 +0700 Subject: [PATCH 2/7] Update: program, modify output --- Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Program.cs b/Program.cs index 034bbd9..e368e44 100644 --- a/Program.cs +++ b/Program.cs @@ -11,6 +11,7 @@ static void Main() Console.WriteLine("Date now: " + DateTime.Now); // Input from user + Console.Write("Type your name: "); var name = Console.ReadLine(); // Output to console Console.WriteLine("Hi, " + name); From 3fb9e1baff392982c18803a2e0dcfaa32bdcf893 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 17:08:19 +0700 Subject: [PATCH 3/7] Update: program.cs add function to call in Main --- Program.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index e368e44..60c0e2c 100644 --- a/Program.cs +++ b/Program.cs @@ -5,15 +5,27 @@ class Program static void Main() { // Output to console basic text - Console.WriteLine("Hello World!"); + // Console.WriteLine(TextHello()); // Output get datetime to console - Console.WriteLine("Date now: " + DateTime.Now); + // Console.WriteLine(GetDateSystem()); // Input from user + Console.WriteLine(InputFromUser()); + } + + static String TextHello() { + return "Hello World!"; + } + + static String GetDateSystem() { + DateTime getDateBySystem = DateTime.Now; + return "Date now: " + getDateBySystem; + } + + static String InputFromUser() { Console.Write("Type your name: "); var name = Console.ReadLine(); - // Output to console - Console.WriteLine("Hi, " + name); + return "Hi, " + name; } } \ No newline at end of file From 6e44086a80d15224eaab9e88716a755bdff04917 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Mon, 10 Feb 2025 17:08:27 +0700 Subject: [PATCH 4/7] Add: README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2d1b46 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +## Project Base Learn .NET Console +Project console .NET basic from 0 to hero + +## a. Get Date by System + +```.cs +Console.WriteLine("Date now: " + DateTime.Now); +``` + +## b. Type Input & Show to Output + +```.cs +Console.Write("Type your name: "); +var name = Console.ReadLine(); +Console.WriteLine("Hi, " + name); +``` \ No newline at end of file From 1595e4ee98f33c78065b371936f115aa18eb8426 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Tue, 11 Feb 2025 23:51:21 +0700 Subject: [PATCH 5/7] Add: Store, Retrieve Data using Literal & Variable Value --- Program.cs | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Program.cs b/Program.cs index 60c0e2c..5f40e70 100644 --- a/Program.cs +++ b/Program.cs @@ -4,28 +4,33 @@ class Program { static void Main() { - // Output to console basic text - // Console.WriteLine(TextHello()); - - // Output get datetime to console - // Console.WriteLine(GetDateSystem()); - - // Input from user - Console.WriteLine(InputFromUser()); + // Call the Function method Type here + ThirdStage(); } - static String TextHello() { - return "Hello World!"; + static void FirstStage() { + string name = "Bob"; + int value = 3; + float temperature = 34.4f; + + Console.WriteLine($"Hello, {name}! You have {value} messages in your inbox. The temperature is {temperature} celsius."); } - static String GetDateSystem() { - DateTime getDateBySystem = DateTime.Now; - return "Date now: " + getDateBySystem; + static void SecondStage() { + decimal value = 3.14159265359m; + double radius = 2.5323; + + Console.WriteLine($"The value of Pi is approximately {value}."); + Console.WriteLine($"The radius of the circle is {radius}."); } - static String InputFromUser() { - Console.Write("Type your name: "); - var name = Console.ReadLine(); - return "Hi, " + name; + static void ThirdStage() { + bool isStatus = false; + int age = 20; + if (age >= 18) { + isStatus = true; + } + + Console.WriteLine($"Is the person {age} years old, an adult? {isStatus}"); } } \ No newline at end of file From 805dc69796bf6cd5e60402ea98550c9207743670 Mon Sep 17 00:00:00 2001 From: aspsptyd Date: Tue, 11 Feb 2025 23:51:32 +0700 Subject: [PATCH 6/7] Update: README.md --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b2d1b46..df5622d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,30 @@ ## Project Base Learn .NET Console Project console .NET basic from 0 to hero -## a. Get Date by System +## a. Store, Retrieve Data using Literal & Variable Value ```.cs -Console.WriteLine("Date now: " + DateTime.Now); +string name = "Bob"; +int value = 3; +float temperature = 34.4f; + +Console.WriteLine($"Hello, {name}! You have {value} messages in your inbox. The temperature is {temperature} celsius."); ``` -## b. Type Input & Show to Output +```.cs +decimal value = 3.14159265359m; +double radius = 2.5323; + +Console.WriteLine($"The value of Pi is approximately {value}."); +Console.WriteLine($"The radius of the circle is {radius}."); +``` ```.cs -Console.Write("Type your name: "); -var name = Console.ReadLine(); -Console.WriteLine("Hi, " + name); +bool isStatus = false; +int age = 20; +if (age >= 18) { + isStatus = true; +} + +Console.WriteLine($"Is the person {age} years old, an adult? {isStatus}"); ``` \ No newline at end of file From 538e8caee0dc4e5ceda9df6eb334a8e07362f301 Mon Sep 17 00:00:00 2001 From: Asep Septiadi <98740335+aspsptyd@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:55:48 +0700 Subject: [PATCH 7/7] Update: adding image result of code --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df5622d..e4d7af6 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ float temperature = 34.4f; Console.WriteLine($"Hello, {name}! You have {value} messages in your inbox. The temperature is {temperature} celsius."); ``` +![Screenshot 2025-02-11 at 23 54 13](https://github.com/user-attachments/assets/13be9a34-0abc-4e8e-b0e5-e3813e5557fb) + + ```.cs decimal value = 3.14159265359m; double radius = 2.5323; @@ -19,6 +22,9 @@ Console.WriteLine($"The value of Pi is approximately {value}."); Console.WriteLine($"The radius of the circle is {radius}."); ``` +![Screenshot 2025-02-11 at 23 54 49](https://github.com/user-attachments/assets/db3b66de-2428-4e46-8229-911b6b5ff2a8) + + ```.cs bool isStatus = false; int age = 20; @@ -27,4 +33,6 @@ if (age >= 18) { } Console.WriteLine($"Is the person {age} years old, an adult? {isStatus}"); -``` \ No newline at end of file +``` + +![Screenshot 2025-02-11 at 23 55 12](https://github.com/user-attachments/assets/ea41a4f1-55f6-4133-b6b0-4f859ed74ba5)