diff --git a/7709Rproblems.Rproj b/7709Rproblems.Rproj index d063e8b..9eef387 100644 --- a/7709Rproblems.Rproj +++ b/7709Rproblems.Rproj @@ -11,3 +11,5 @@ Encoding: UTF-8 RnwWeave: knitr LaTeX: pdfLaTeX + +BuildType: Website diff --git a/fizzbuzz.Rmd b/fizzbuzz.Rmd index d407c6c..020b827 100644 --- a/fizzbuzz.Rmd +++ b/fizzbuzz.Rmd @@ -1,7 +1,7 @@ --- -title: "Fizzbuzz" -author: "Matt" -date: "2/12/2019" +title: "FizzBuzz" +author: "Richard Troise" +date: "2/25/2019" output: html_document --- @@ -9,24 +9,31 @@ output: html_document knitr::opts_chunk$set(echo = TRUE) ``` -This document contains student solutions to the fizzbuzz problem. Students will add to this file using the outline below. Write your name (using three hashtags), then below create an R code block and insert your code. Save the .rmd file, then knit the document to update the html output. Then submit a pull request to merge your changes to the main repository. +```{r, eval = FALSE} + vec_num <- c(1:100) -### Student Name + k <- 1 + while(k <= 100) { + if(vec_num[k]%%3==0 || vec_num[k]%%5==0) { + if(vec_num[k]%%3==0 && vec_num[k]%%5== 0) { + print("FizzBuzz") + k <- k + 1 + } + else if(vec_num[k]%%5 == 0) { + print("Buzz") + k <- k + 1 + } + else { + print("Fizz") + k <- k + 1 + } + } + + else { + print(vec_num[k]) + k <- k + 1 + } -```{r} -#your code here -1+1 -``` - -### Matt's Code - -```{r,eval=F} -answer <- 1:100 -for(i in 1:100){ - if(i%%3 == 0) answer[i] <-"fizz" - if(i%%5 == 0) answer[i] <-"buzz" - if(i%%5 == 0 & i%%3 ==0) answer[i] <-"fizzbuzz" } -print(answer) ``` diff --git a/fizzbuzz.html b/fizzbuzz.html index c30a140..069a506 100644 --- a/fizzbuzz.html +++ b/fizzbuzz.html @@ -9,205 +9,20 @@ - + -Fizzbuzz +FizzBuzz - + - - - - - - - + + + + + + + - - - - - - + + + + + + +