Question

4. Write a for() loop that prints the first four numbers of this sequence: x 〈-c(7, 4, 3, 8, 9, 25)

use Rstudio

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Code to print the first 4 numbers of this sequence

x <- c(7,4,3,8,9,25)
for (i in 1:4) #using for loop, running counter variable i from 1 to 4
{
   print(x[i]) #printing first 4 values
}

#OutputRGU 82 bit) File Edit Windows Hep fCode to print the rirst numbers of this sequence xc(7,4.,3,8,9,25) tor in 1:4) fusing for loop, running counter variable i trom l to 4 print (x[1]) #printing first values [11 7 [1 4 [11 3 [11 8 R Untitled-R Editor #code τ0 print the first 4 numbers of this sequence x-c(7,4,3.8.9,25) for (i in 1:4) #using for loop, runn ing counter variable i from 1 to 4 print (x[1]) #printing first 4 values

7

4

3

8

Add a comment
Know the answer?
Add Answer to:
use Rstudio 4. Write a for() loop that prints the first four numbers of this sequence:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT