vendredi 3 avril 2020

Using ifelse to sum numbers

I'm noob in coding, so i'm having a hard time finishing assignments. i wanna get some help..

  1. Using ifelse and seq commands in R, calculate the sum of numbers that are evenly divided by 6 between 1 and 1000. (The answer is not unique, but your answer should use ifelse and seq properly.)

  2. Calculate the sum of numbers that are evenly divided by 3 between 1 and 1000. by for loop. Show your coding and the sum. (Answer is not unique. Any reasonable for loop will get full points.)

I know that I should use seq(6,1000,6) and seq(3,1000,3) for each, but I cannot get the answer pls help

Aucun commentaire:

Enregistrer un commentaire