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
Get step-by-step solutions from verified subject matter experts
