adplus-dvertising
frame-decoration

Question

Which of the following R code generate a sequence of integers from 1 to 10?

a.

> for(i in 1:9) {
+ print(i)
+ }
[1]

b.

> for(i in 0:9) {
+ print(i)
+ }
[1]

c.

> for(i in 1:10) {
+ print(i)
+ }
[1]

d.

> for(i in 2:50) {
+ print("i")
+ }
[1]

Posted under R Programming

Answer: (c).> for(i in 1:10) {
+ print(i)
+ }
[1]

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following R code generate a sequence of integers from 1 to 10?