1 year ago
#387033
OnlyForFun
How to check if is a number divisible
Why my program does not work? I want to print n in every cycle, which it will be comparing if number n is divisible by 2, or divisible by 3 and 5 or divisible by none of these numbers. Thanks for help.
funkcia = function(n){
for (i in 1:n){
if (n/2 == 0){
n = n*n
print (n)
}
else if(n/3 == 0 & n/5 == 0){
n =n*n*n
print(n)
}
else {
n = n
print(n)
}
}
}
r
jupyter-lab
google-cloud-datalab
0 Answers
Your Answer