Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Integer Division and Remainders | Basic Syntax and Operations
R Introduction: Part I
course content

Conteúdo do Curso

R Introduction: Part I

R Introduction: Part I

1. Basic Syntax and Operations
2. Basic Data Types and Vectors
3. Factors

bookInteger 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:

1234
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
copy
Tarefa
test

Swipe to show code editor

For the following exercises:

  1. Compute how many complete days there are in 435 hours.
  2. Determine how many hours would be left over.

Keep in mind that a day is comprised of 24 hours.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 5
toggle bottom row

bookInteger 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:

1234
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
copy
Tarefa
test

Swipe to show code editor

For the following exercises:

  1. Compute how many complete days there are in 435 hours.
  2. Determine how many hours would be left over.

Keep in mind that a day is comprised of 24 hours.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 5
toggle bottom row

bookInteger 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:

1234
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
copy
Tarefa
test

Swipe to show code editor

For the following exercises:

  1. Compute how many complete days there are in 435 hours.
  2. Determine how many hours would be left over.

Keep in mind that a day is comprised of 24 hours.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

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:

1234
# Number of candies for each friend 16 %/% 3 # Number of candies remaining 16 %% 3
copy
Tarefa
test

Swipe to show code editor

For the following exercises:

  1. Compute how many complete days there are in 435 hours.
  2. Determine how many hours would be left over.

Keep in mind that a day is comprised of 24 hours.

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 5
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt