Skip to content

Commit

Permalink
CS003 ArithmeticAssignment
Browse files Browse the repository at this point in the history
  • Loading branch information
XuanThuLab committed Aug 8, 2020
1 parent a4a4257 commit a49d0d5
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
27 changes: 27 additions & 0 deletions CS003_ArithmeticAssignment/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/CS003_ArithmeticAssignment.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions CS003_ArithmeticAssignment/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/CS003_ArithmeticAssignment.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/CS003_ArithmeticAssignment.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/CS003_ArithmeticAssignment.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
8 changes: 8 additions & 0 deletions CS003_ArithmeticAssignment/CS003_ArithmeticAssignment.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
80 changes: 80 additions & 0 deletions CS003_ArithmeticAssignment/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;

namespace CS003_ArithmeticAssignment
{
class Program
{
static void Main(string[] args)
{

// // Cộng - Trừ
// int a = 28;
// int b = 10;
// Console.WriteLine(a + b); // In ra: 38
// Console.WriteLine(a - b); // In ra: 18

// // Nhân
// float a = 1.2f;
// int b = 3;
// Console.WriteLine(a * b); // In ra 3.6

// // Chia
// float a = 1.2f;
// int b = 3;
// Console.WriteLine(a / b); // In ra 0.4

// // Chia 2 số nguyên
// int a = 10;
// int b = 3;
// Console.WriteLine(a / b); // In ra 3
// Console.WriteLine(a / (float)b); // In ra 3.333333

// // Chia lấy dư
// int a = 8;
// int b = 3;
// Console.WriteLine(a % b); // In ra 2

// // Độ ưu tiên
// Console.WriteLine(5 + 3 * 2); // 11
// Console.WriteLine(6 / 2 + 3 * 2); // 9
// Console.WriteLine(6 / (2 + 3) * 2); // 2

// // Toán tử gán =
// int x = 10 + 12; // x bằng 22
// Console.WriteLine(x);

// // Toán tử +=
// int x = 10;
// x += 2; // x bằng 12

// // Toán tử -=
// int c = 10;
// c -= 3; // c = 7

// //Toán tử *=
// int x = 2;
// x *= 3; //x = 6



//// Tăng - Giảm
// int a = 10;
// a++; // a là 11 (thêm 1)
// ++a; // a là 12 (thêm 1)

// a--; // a là 11 (bớt 1)
// --a; // a là 10 (bớt 1)

// int a = 5;
// int b = 2 * a++; // b = 10; a = 6








}
}
}
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Ví dụ về các toán tử số học (Arithmetic Operators) và toán tử gán (Assignment Operators)
https://xuanthulab.net/cac-toan-tu-tinh-toan-so-hoc-trong-c-toan-tu-gan-va-tang-giam.html

0 comments on commit a49d0d5

Please sign in to comment.