Conteúdo do Curso
R Introduction: Part I
R Introduction: Part I
Integer Division and Remainders
Integer division is a common mathematical operation that we often use in daily life, sometimes without even realizing it.
Take, for instance, the scenario where you have 16
candies and want to divide them equally among 3
friends. Each friend would get 5
candies, with one candy left over, since 16 = 5 * 3 + 1
. We say that the result of the integer division of 16
by 3
is 5
, and the remainder of this division is 1
.
In R, these operations are performed using:
%/%
for integer division;%%
for the remainder of a division.
Here is how we can calculate the given example in R:
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
Tarefa
For the following exercises:
- Compute how many complete days there are in
435
hours. - Determine how many hours would be left over.
Keep in mind that a day is comprised of 24 hours.
Obrigado pelo seu feedback!
Integer Division and Remainders
Integer division is a common mathematical operation that we often use in daily life, sometimes without even realizing it.
Take, for instance, the scenario where you have 16
candies and want to divide them equally among 3
friends. Each friend would get 5
candies, with one candy left over, since 16 = 5 * 3 + 1
. We say that the result of the integer division of 16
by 3
is 5
, and the remainder of this division is 1
.
In R, these operations are performed using:
%/%
for integer division;%%
for the remainder of a division.
Here is how we can calculate the given example in R:
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
Tarefa
For the following exercises:
- Compute how many complete days there are in
435
hours. - Determine how many hours would be left over.
Keep in mind that a day is comprised of 24 hours.
Obrigado pelo seu feedback!
Integer Division and Remainders
Integer division is a common mathematical operation that we often use in daily life, sometimes without even realizing it.
Take, for instance, the scenario where you have 16
candies and want to divide them equally among 3
friends. Each friend would get 5
candies, with one candy left over, since 16 = 5 * 3 + 1
. We say that the result of the integer division of 16
by 3
is 5
, and the remainder of this division is 1
.
In R, these operations are performed using:
%/%
for integer division;%%
for the remainder of a division.
Here is how we can calculate the given example in R:
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
Tarefa
For the following exercises:
- Compute how many complete days there are in
435
hours. - Determine how many hours would be left over.
Keep in mind that a day is comprised of 24 hours.
Obrigado pelo seu feedback!
Integer division is a common mathematical operation that we often use in daily life, sometimes without even realizing it.
Take, for instance, the scenario where you have 16
candies and want to divide them equally among 3
friends. Each friend would get 5
candies, with one candy left over, since 16 = 5 * 3 + 1
. We say that the result of the integer division of 16
by 3
is 5
, and the remainder of this division is 1
.
In R, these operations are performed using:
%/%
for integer division;%%
for the remainder of a division.
Here is how we can calculate the given example in R:
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
Tarefa
For the following exercises:
- Compute how many complete days there are in
435
hours. - Determine how many hours would be left over.
Keep in mind that a day is comprised of 24 hours.