Question: Write an R program to print the numbers from 1 to 20 and print Green for multiples of 3, print Blue for multiples of 5,

Write an R program to print the numbers from 1 to 20 and print "Green" for multiples of 3, print "Blue" for multiples of 5, and print "Cyan" for multiples of both. The output should look as follows:

[1] 1

[1] 2

[1] "Green"

[1] 4

[1] "Blue"

[1] "Green"

[1] 7

[1] 8

[1] "Green"

[1] "Blue"

[1] 11

[1] "Green"

[1] 13

[1] 14

[1] "Cyan"

[1] 16

[1] 17

[1] "Green"

[1] 19

[1] "Blue"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!