Basic Arithmetic
Unlike many other programming languages, R doesn't need a specific function to display output. So, let's begin our R journey with some simple arithmetic to get started.
In R, you can perform basic arithmetic using the following operators:
+
for addition;-
for subtraction;*
for multiplication;/
for division.
For example, let's compute a few mathematical expressions:
9
1
2
3
12 + 21
32 - 16
10 * 11
12312 + 21 32 - 16 10 * 11
As you can see, there's nothing complicated here.
Oppgave
Swipe to start coding
Perform the following calculations using basic arithmetic operations:
30 + 24
;50 - 36
;19 * 7
.
Løsning
9
1
2
3
30 + 24
50 - 36
19 * 7
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
9
1
2
3
___
___
___
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår