Skip to content

Commit

Permalink
Add programming docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iHiD committed Jan 29, 2024
1 parent 397366d commit bc0482c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions programming/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Programming

Docs on programming topics
23 changes: 23 additions & 0 deletions programming/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"uuid": "1a737701-e2f7-4021-9057-a0faf4738740",
"slug": "APEX",
"path": "programming/README.md",
"title": "Programming docs",
"blurb": "Docs on programming topics"
},
{
"uuid": "54390764-ef34-4385-b714-ab2851bdd814",
"slug": "reaminder",
"path": "programming/operators/README.md",
"title": "Operators",
"blurb": "Docs on operators"
},
{
"uuid": "f1848a5a-593d-411f-9d44-4d4849690e1e",
"slug": "remainder",
"path": "programming/operators/remainder.md",
"title": "Remainder",
"blurb": "The remainder operators"
},
]
3 changes: 3 additions & 0 deletions programming/operators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Operators

Docs on operators
30 changes: 30 additions & 0 deletions programming/operators/remainder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Remainder

In mathematics, the **remainder** is the amount "left over" after performing some computation.
For example, the remainder of `5 / 3` is `2`.

Many programming languages use the percentage sign (`%`) as an operator to calculate the remainder.
For example, this is valid code in Javascript and Python:
```javascript
5 % 3 == 2
```

Remainders can often be calculated on both integers and floating point numbers.
For example,
```javascript
5.3 % 3 == 2.3
```

When working with negative numbers, the result always has the same sign as the dividend (the number on the left hand side that is being divided).
For example:
```javascript
-5 % 3 == -2
5 % -3 == 2
-5 % -3 == -2
```

Some languages use the `%` operator for the calculating the modulus, not the remainder.
This treats negative numbers differently.
You can learn more about this [on Wikipedia](https://en.wikipedia.org/wiki/Modulo).


0 comments on commit bc0482c

Please sign in to comment.