diff --git a/Alex Kerr lab 1.md b/Alex Kerr lab 1.md new file mode 100644 index 0000000..9188a5a --- /dev/null +++ b/Alex Kerr lab 1.md @@ -0,0 +1,145 @@ +# Lab 1 + +## Description and guidelines +You have multiple tasks to complete. You may work with others, however your goal should be on understanding the logic of the flow charts you are creating, and by the end feel comfortable analyzing a problem, breaking it down into steps, and be able to create a flow chart of those ideas. You should also feel comfortable looking at a flow chart and determining if you feel it solves the problem it is for. + +With this lab, you will want to use a unispace font. One way to gain this is to put your answers betwwen lines that contain three ~ characters: + +~~~ +This is a unispace font, notice that +iiii takes up as much space as +wwww. +~~~ + +To draw the boxes, +* Use hyphens for the top and bottom of the statement boxes (you do not need to worry about the sides). +* Use |, +, - to draw the lines. +* Use <, >, ^, or v for the arrow heads. +* Use / and \ for the borders of conditionals (you only need to show the corners, and these do not need to line up.) +* Have your lines that go up do so to the right of your text. + +Example: +~~~ +----------------------- +This is the first step <-----+ +----------------------- | + | | + V | + / \ | + / \ Yes | +/ If something is true \ -----+ +\ and the day is / + a Monday + \ / + \ / + | No + v +--------------------- +The last step +--------------------- +~~~ + +## Flowchart Tasks: + +#### 1. Fizzbuzz +* starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz" +~~~ +---------------------- +import user number +n=1 +--------------------- + | _______>__________>________>__________________>_______| + v | | + / \ Yes | + / \ | v + / \_<_No_<__does n = i______<_____n=n+1___<____<__ | + / i= given number\ | | + divide the number by 2 A | +/ is there a remander ? __>____ no_>__Print "Fizz"____>_______| | +\ / | | + \ / | v + \ / A | + \/ | | + | | | + | | | + Yes | | + | | | + v | v + | | | + divide the number by 3 | | + is there remander ______>____no____>____Print "buzz"___>_____| | + | | | + | | | + Yes A v + | | | + v | | + Print "number"___>________________>_________>_____> | | + break code + ~~~ +#### 2. Determin a students letter grade when given the %. +~~~ +--------------------- +import student grade +--------------------- + | + | + | +is the grade in 100______>______Yes____>___Print "A"______| +to 90 | + | | + | | + NO | + | | + | | +is the grade in 90______>______Yes____>___Print "B"_______| +to 80 | + | | + | | + NO | + | | + | | +is the grade in 80______>______Yes____>___Print "C"_______| +to 70 | + | | + | | + NO | + | | + | | +is the grade in 70______>______Yes____>___Print "D"_______| +to 60 | + | | + | | + No | + | | + | | + | | + Print "F"______>_________>____________>_______________>Break code + ~~~ +#### 3. Convert a tempature from C to F or vice versa. + +#### 4. When give three numbers return the largest of them + +#### 5. The game of Nim: +* This game is played between two players. +* There are piles of stones, the number of stones in each pile is known. +* Each turn a player can take any number of stones away from a single pile (they must take at least one.) +* The person who takes the last stone from the last remaining pile looses. + +a. Create a flow chart for the optimal move for a player if there is only one pile. + +b. Create a flow chart for the optimal move for a player if there are exatly two piles. + +c. Can you merge these together to create a flowchart for an optimal move if there are two or less piles? Please do so, if yes. + +d. What about if there are any number of piles. + +#### 6. Find the sum of the first 100 numbers +b: modify this to find the sum of the next 100 numbers when given a starting value. + +#### 7. Find the nth fibonaci number +* The 0th and the 1st fibonaci numbers are both 1. +* All other fibonaci numbers equal the sum of the two before it. + So the 2nd fibonaci number is 2, because fib(0)+fib(1) = 1+1 + Also the 10th fibonaci number is fib(8)+fib(9) + +#### 8. Find the largest prime number less than a given number diff --git a/Ben Lab 1 b/Ben Lab 1 new file mode 100644 index 0000000..c1c8ac8 --- /dev/null +++ b/Ben Lab 1 @@ -0,0 +1,80 @@ +_________________________________________________________________________________________________________________________ +#1) +------+ + _______________ +-----+ /\ | Stop | + Start with Zero | "?" | = / \ +------+ + _______________ +-----+ \ / ^ + | \/ Yes + V | + +---------------+ +--------------+ + |Is the number |<-------------------<-------No------|Has end number|--+ + +---No--------|divisible by 2?|-------Yes---+ | been reached?| | + | +---------------+ | +--------------+ | + | | | + | | | + | V | + | +------+ | + | | Fizz | +-------+ + V +------+ | Add 1 | + +----------------+ | +-------+ + | Is the number | +------+ V ^ + | divisible by 3?|---Yes---> | Buzz | +----------------+ | + +----------------+ +------+ | Is the number | +------+ | + | | divisible by 3?|---Yes-->| Buzz | | + No +----------------+ +------+ | + | | | + V No | + +-----------+ | | + | Print the | V | + | Number |-------------------->--------------------------->----------------------------+ + +-----------+ +__________________________________________________________________________________________________________________________ + +#2) + ________________ + Grade percentage + ________________ + | + V + 90%-100%----Yes---> A + | + No + | + V + 80%-89%----Yes---> B + | + No + | + V + 70%-79%----Yes---> C + | + No + | + V + 60%-69%----Yes---> D + | + No + | + V + 0%-59%----Yes---> F +_________________________________________________________________________________________________________________________ + +#3) + + + + + + + + + + + + + + + + + + + diff --git a/Frazier.md b/Frazier.md new file mode 100644 index 0000000..e03de21 --- /dev/null +++ b/Frazier.md @@ -0,0 +1,173 @@ +~~~ + +Fizzbuzz + +--------------- + start +--------------- + | + v +--------------- +Set "start" equal to 0 +--------------- + | + v +--------------- +Set "end" equal to user input +--------------- + | + v <-----------------------------------+ + / \ | + / \ | +/ \ No | +start is less than or equal to end -----|-------->+ +\ / | | + \ / | | + | Yes | | + v | | +--------------- Yes | | +if start%6==0 ----> print fizzbuzz + | | +---------------- | | | + | No | | | + v | | | +---------------- Yes | | | +else if start%2==0 ---> print fizz + | | +----------------- | | | + | No | | | + v | | | +------------------ Yes | | | +else if start%3==0 ----> print buzz + | | +----------------- | | | + | | | | + v | | | +------------------ | | | +else print start | | | +------------------- | | | + | | | | + v | | | +------------------- | | | +start=++ <-----------------+ | | +------------------- | | + | | | + v | | + +------------------------------------+ | + | +------------------ | +Print "done" <----------------------------------+ +------------------ + + + +start=0; +end=# given by user + +if (start<=end){ + if (start%6==0){ + print "fizzbuzz"} + if else (start%2==0){ + print "fizz"} + if else (start%3==0){ + print "buzz"} + else { + print start} + start=start+1;} +else { +print done +} + + + +Letter Grade + +------------ +Enter Percent +------------ + | + v +------------- +if percent >= 90 print A +------------- + | + v +------------- +else if percent<90 and percent>=80 print B +------------- + | + v +------------- +else if percent<80 and percent>=70 print C +------------- + | + v +-------------- +else if percent<70 and percent>=60 print D +-------------- + | + v +--------------- +else print fail +--------------- + | + v +-------------- +end +-------------- + +percent= user input + +if (percent>=90){ + print "A"} +if else (percent>=80){ + print "B"} +if else (percent>=70){ + print "C"} +if else (percent>=60){ + print "D" +else { + print "F"} + + +The game of nim + +one pile-take all but one stone +two piles -take all but one they take all of second pile you lose + -take all they take all but one you lose + X -take all but two, they take the rest, go to one pile strategy you win + -take all but two, they take all but + X -take all but two they take all but two of second pile + -take + -take all but + +end= take all but 1 +Goal x=1 + +one pile with n stones +take n-1 stones + +two piles with n and m stones +take n-2 stones + they take m stones + taken n-1 stone x=1 + they take new n stones + take m-1 stones x=1 + they take m-2 stones stone count m=2 n=2 + take n-1 stone count m=2 n=1 + they take n stone count m=2 + take m-1 win + they take m you lose n=1 + they take m-1 stone count m=1 n=1 + they take m-1 + take new n + they take m-#>2 + + + + + + + + + + + + diff --git a/Jackson_Maschman_Lab_1 b/Jackson_Maschman_Lab_1 new file mode 100644 index 0000000..1d8c4e8 --- /dev/null +++ b/Jackson_Maschman_Lab_1 @@ -0,0 +1,190 @@ +Lab_1 + +1.) FizzBuzz + +--------------------------------- +First Step: User imputs a number +--------------------------------- + | + | + V <-------------------------------------------------------------+ +/ \ | + Is the number divisible by 2? ---[NO] | +\ / | | + | | + | | | + [YES] | | + | | | + V | | +/ \ | | + Print "Fizz" | | +\ / | | + | | | + |<-------------------------+ | + V | +/ \ | + Is the number divisible by 3? -----[NO]------------------+ | +\ / | | + | | | + [YES] | | + | | | + V | | +/ \ | | + Print "Buzz" | | +\ / | | + | | | + |<----------------------------------------------+ | + V | +/ \ | + Is the number not divisible by 2 or 3? --------[NO] | +\ / | | + | | | + [Yes] | | + | | | + V | | + / \ | | + Print number | | + \ / | | + | <---------------------------------+ | + | | + V | +/ \ | + Add 1 to number --------------------------------------------+ +\ / + + +2.) Student Letter Grade + +------------------------------------------- + Identify Student Grade From 0%-100% +------------------------------------------- + | + V +/ \ / \ + Is the grade 90% or higher? ---[Yes]---> Give the student an A +\ / \ / + | + [No] + | + V +/ \ / \ + Is the grade 80% or higher and lower than 90%? ---[YES]---> Give the student a B +\ / \ / + | + [NO] + | + V +/ \ / \ + Is the grade 70% or higher and lower than 80%? ---[YES]---> Give the student a C +\ / \ / + | + [NO] + | + V +/ \ / \ + Is the grade 60% or higher and lower than 70%? ---[YES]---> Give the student a D +\ / \ / + | + [NO] + | + V +/ \ + Give the student an F +\ / + +3.) Temperature + +------------------------------------------------- + Identify a Value Representing Temperature +------------------------------------------------- + | + V +/ \ / \ + Is the temperature in Fahrenheit? ---[YES]---> Subtract 32 from the number and multiply the result by (5/9) +\ / \ / + | + [NO] + | + V +/ \ / \ + Is the temperature in Celsius? ---[YES]---> Multiply the number by (9/5) and add 32 to the product +\ / \ / + | + [NO] + | + V +/ \ + Scrap that number and move on with your life +\ / + +4.) Three Numbers + +------------------------- + Get Three Numbers +------------------------- + | + V +/ \ / \ / \ +Is the first number greater than the second number? ----[YES]-->Is the first number greater than the third number? -[YES]->Print 1st # +\ / \ / \ / + | | + | [NO] + | | + [NO] <------------------------------------------------------------------+ + | + V +/ \ / \ + Is the second number greater than the third number? ---[YES]--> Print Second Number +\ / \ / + | + [NO] + | + V +/ \ + Print third number +\ / + +6.) First 100 Numbers + +--------------------- + Find a Number +--------------------- + | + | + V +/ \ + Have a counter equal 1. +\ / + | + V +/ \ + Have your number equal the variable x +\ / + | + | <-----------------------------------------+ + V | +/ \ | + Save value x | +\ / | + | | + V | +/ \ | + Have x = x + 1 | +\ / | + | | + V | +/ \ | + Add 1 to counter | +\ / | + | | + V | +/ \ | + Does the counter equal 100? ---[NO]-------------+ +\ / + | + [YES] + | + V +/ \ + Add all saved values and print result. Then stop. +\ / diff --git a/Jared Pohlmann Lab 1 Code b/Jared Pohlmann Lab 1 Code new file mode 100644 index 0000000..c37a348 --- /dev/null +++ b/Jared Pohlmann Lab 1 Code @@ -0,0 +1,50 @@ +### 1. Fizzbuzz Code +number = 1 +end = 100 +while(number<=end) +{ +if(number%2==0) +{ + system.out.print("Fizz") + number = number + 1 +} +else if(number%3==0) +{ + system.out.print("Buzz") + number = number + 1 +} +else() +{ +system.out.print(number) +number = number + 1 +} +} + +### 2. Determine a student's letter grade when given % +grade = +if(grade >= 90) +{ +system.out.print("A") +} +else if( grade >=80) +{ +system.out.print("B") +} +else if( grade >= 70) +{ +system.out.print("C") +} +else if( grade >= 60) +{ +system.out.print("D") +} +else() +{ +system.out.print("F") +} +### 8. Find Largest prime number less than a given number +prime = 23 +num = prime - 1 +while(num > 1) +{ +if ( diff --git a/JaredPohlmannLab1.md b/JaredPohlmannLab1.md new file mode 100644 index 0000000..2a68433 --- /dev/null +++ b/JaredPohlmannLab1.md @@ -0,0 +1,159 @@ +#### 1. Fizzbuzz +* starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz" +~~~ +----------- +Start +----------- + | + V +--------------------- +Set start number to 1 +---------------------- + | ------------------- + V <<---------------+ Add 1 to the Number<-+| + / \ ------------------- | + / \ | | +/Is number \ Yes ---- ------- | +\divisible /---------- Print "Fizz" | + by 2 ------------ | + \ / | + \ / | + | No | + V | + / \ | + / \ | + /Is number \ Yes ------------- |<<---------+ + \divisible /--------------- Print "Buzz" ------- | + by 3 -------------- | + \ / | + \ / | + | No | + V | + -------------------- | + Print out the number--------------------------------------+ + -------------------- + + number = 1 +end = 100 +while(number<=end) +{ +if(number%2==0) +{ + system.out.print("Fizz") + number = number + 1 +} +else if(number%3==0) +{ + system.out.print("Buzz") + number = number + 1 +} +else() +{ +system.out.print(number) +number = number + 1 +} +} +~~~ + #### 2. Determine a students letter grade when given the %. + ~~~ +----------------------- +Start +----------------------- + | + V + / \ + / \ Yes ------------- +/ Is the % between 90 \ -----Print out 'A" +\ and 100% / ------------- + + \ / + \ / + | No + v + | + V + / \ + / \ Yes ------------- +/ Is the % between 80 \ -----Print out 'B" +\ and 90% / ------------- + + \ / + \ / + | + V No + + V + / \ + / \ Yes ------------- +/ Is the % between 70 \ -----Print out 'C" +\ and 80% / ------------- + + \ / + \ / + V + + + / \ + / \ Yes ------------- +/ Is the % between 60 \ -----Print out 'D" +\ and 70 % / ------------- + + \ / + \ / + | No + + V + ------------ + Print out "F" + ------------ +grade = +if(grade >= 90) +{ +system.out.print("A") +} +else if( grade >=80) +{ +system.out.print("B") +} +else if( grade >= 70) +{ +system.out.print("C") +} +else if( grade >= 60) +{ +system.out.print("D") +} +else() +{ +system.out.print("F") +} +~~~ + +#### 8. Find the largest prime number less than a given number +~~~ +----------------------- + Start +----------------------- + | + V + ----------------------------- + Select Largest Starting number + ------------------------------ + | + V + ------------------------------ + Subtract 1 from Previous Number + ------------------------------- <----------------------- | + | | + V | + / \ | + / \ No ----------------------- | +/ Is number \---------------Print that Prime Number | +\ composite / ----------------------- | + | + \ / | + \ / | + | Yes | + v----------------------------------------------------- + + diff --git a/Jeffrey's Lab 1 b/Jeffrey's Lab 1 new file mode 100644 index 0000000..e8b65e9 --- /dev/null +++ b/Jeffrey's Lab 1 @@ -0,0 +1,83 @@ +to convert from Celsius to Fahrenheit + ----------------------- + Take the input of the number to convert <-----+ + ----------------------- + | + V + / \ + /is this celsius?\ + YES \ / NO-------------------+ + | \/ | + | | + | | + V V + / \ / \ + /Put it into this formula\ / Put the number into this formula\ + / "input number" x 18. + 32\ \ "input number" - 32 x .5556 / + \ / \ / + \ / \ / + \ / + --------------------- + The last step + --------------------- + + + +----------------------- +How to find a letter grade from percentage +input grade + +----------------------- + | + V + / \ + / \ Yes +/Is the number between 100 and 80 \ ------------------------------------+ +\ / | + \ / | + \ / | + | No | + | / \ + | / is the number\ No + | \ in the 90s? / ------------>|You got a B. Not bad| + V \ / + / \ \ / +/ is the number\ Yes | Yes +\ in the 60s? / ---------------------------|You got a C| V + \ / |a good try | / \ + No /you got an A!!!!!!\ + | \ :O :O / + | \ / + V + / \ No + /Is it below 60?\-------------> |You got a D, could be better.| + \ / + | Yes + | + V +|You got a F bro. srsly| +--------------------- +The last step +--------------------- + +Sum to 100 +----------------------- +This is the first step <-----+ +----------------------- | + | | + V | + / \ | + / \ Yes | +/ If something is true \ -----+ +\ and the day is / + a Monday + \ / + \ / + | No + v +--------------------- +The last step +--------------------- + + +I did the two above and I troubleshot like 3 fizzbuzzes. diff --git a/Lab_1.md b/Lab_1.md deleted file mode 100644 index a3d5bfa..0000000 --- a/Lab_1.md +++ /dev/null @@ -1,76 +0,0 @@ -# Lab 1 - -## Description and guidelines -You have multiple tasks to complete. You may work with others, however your goal should be on understanding the logic of the flow charts you are creating, and by the end feel comfortable analyzing a problem, breaking it down into steps, and be able to create a flow chart of those ideas. You should also feel comfortable looking at a flow chart and determining if you feel it solves the problem it is for. - -With this lab, you will want to use a unispace font. One way to gain this is to put your answers betwwen lines that contain three ~ characters: - -~~~ -This is a unispace font, notice that -iiii takes up as much space as -wwww. -~~~ - -To draw the boxes, -* Use hyphens for the top and bottom of the statement boxes (you do not need to worry about the sides). -* Use |, +, - to draw the lines. -* Use <, >, ^, or v for the arrow heads. -* Use / and \ for the borders of conditionals (you only need to show the corners, and these do not need to line up.) -* Have your lines that go up do so to the right of your text. - -Example: -~~~ ------------------------ -This is the first step <-----+ ------------------------ | - | | - V | - / \ | - / \ Yes | -/ If something is true \ -----+ -\ and the day is / - a Monday - \ / - \ / - | No - v ---------------------- -The last step ---------------------- -~~~ - -## Flowchart Tasks: - -#### 1. Fizzbuzz -* starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz" - -#### 2. Determin a students letter grade when given the %. - -#### 3. Convert a tempature from C to F or vice versa. - -#### 4. When give three numbers return the largest of them - -#### 5. The game of Nim: -* This game is played between two players. -* There are piles of stones, the number of stones in each pile is known. -* Each turn a player can take any number of stones away from a single pile (they must take at least one.) -* The person who takes the last stone from the last remaining pile looses. - -a. Create a flow chart for the optimal move for a player if there is only one pile. - -b. Create a flow chart for the optimal move for a player if there are exatly two piles. - -c. Can you merge these together to create a flowchart for an optimal move if there are two or less piles? Please do so, if yes. - -d. What about if there are any number of piles. - -#### 6. Find the sum of the first 100 numbers -b: modify this to find the sum of the next 100 numbers when given a starting value. - -#### 7. Find the nth fibonaci number -* The 0th and the 1st fibonaci numbers are both 1. -* All other fibonaci numbers equal the sum of the two before it. - So the 2nd fibonaci number is 2, because fib(0)+fib(1) = 1+1 - Also the 10th fibonaci number is fib(8)+fib(9) - -#### 8. Find the largest prime number less than a given number diff --git a/Shane_Lab b/Shane_Lab new file mode 100644 index 0000000..d30e158 --- /dev/null +++ b/Shane_Lab @@ -0,0 +1,228 @@ +~~~ +________Fizzbuzz_______________________________________________________________________________ +--------------------------- +Start with the number one +and incerement by one to a +number that is given. +--------------------------- + | + V + / \ + / \ Yes ----------------- + / If the number is not \ ----------> Print the number + \ divisible by 2 or 3 / ----------------- + \ / + \ / + | + | No + | + V Yes Yes ------------------- +/ If the number is divisible \ ---------> / If the number is divisible \ ---------> Print "Fizz" & Buzz" +\ by 2 / \ by both 2 and 3 / ------------------- + \ / \ / + \ / \ / + | | + | No | + | No | + |-------------------------------------------+ + | + | + | + | + / \ + / \ Yes ----------- +/ If the number is divisible \ --------- > Print "Buzz" +\ by three. / ----------- + \ / + \ / + | + | No + | + V + ------------ + Print "Fizz" + ------------ + + + + + + + +________Determine the students letter grade when given the %_______________________________________ +-------------------------- +Identify a student's grade +percentage from 0-100% +-------------------------- + | + V + / \ + / \ Yes ----------------- + / If the student's grade \ ----------> Letter Grade: F + \ is between 0-59% / ----------------- + \ / + \ / + | + | No + | + V + / \ + / \ Yes ----------------- + / If the student's grade \ ----------> Letter Grade: D + \ is between 60-66% / ----------------- + \ / + \ / + | + | No + | + V + / \ + / \ Yes ----------------- + / If the student's grade \ ----------> Letter Grade: D+ + \ is between 67-79% / ----------------- + \ / + \ / + | + | No + | + V + {Continue process in + incremements of 3% + until 100% is reached} + +________Convert a temperature from C to F and vice versa_______________________________________ + + -------- + Start + -------- + | + ---------------------------------------- + Identify the temperature for conversion (numerical value) + ---------------------------------------- + | + | + V + / \ + C > F / \ F > C ++------------------------------------/ Identify the type of conversion desired \ -----------------------------------------+ +| \ / | +| \ / | +| \ / | +| | +V V +---------------------------- ---------------------------- +Subtract 32 from value Multiply the value by 9 +---------------------------- ---------------------------- +| | +V V +---------------------------- ---------------------------- +Multiply new value by 5 Divide new value by 5 +---------------------------- ---------------------------- +| | +V V +---------------------------- ---------------------------- +Divide new value by 9 Add 32 to the new value +---------------------------- ---------------------------- +| | +V V +---------------------------- ---------------------------- +Temperature in Fahrenheit is displayed Temperature in Celsius is displayed +---------------------------- ---------------------------- +| | +| ------ | ++--------------------------------------------------> STOP <---------------------------------------------------------------+ + ------ + + +________When given three numbers, return the largest one_______________________________________ + +---------------------------- + Start +---------------------------- + | + V +---------------------------- +Begin with three values +---------------------------- + | + V +---------------------------- +Select one of the values +---------------------------- + | + V + / \ + / \ Yes ----------------- + / Is the value the \ ----------> Print the number + \ greatest of the 3 / ----------------- + \ / + \ / + | + | No + | + V +---------------------------- +Select a different value +---------------------------- + | + V + / \ + / \ Yes ----------------- + / Is the value the \ ----------> Print the number + \ greatest of the 3 / ----------------- + \ / + \ / + | + | No + | + V +---------------------------- +Select a different value +---------------------------- + | + V +---------------------------- +Print the number (largest by default) +---------------------------- + | + V +---------------------------- + Stop +---------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +~~~ diff --git a/Skylar.md b/Skylar.md new file mode 100644 index 0000000..6df7bcc --- /dev/null +++ b/Skylar.md @@ -0,0 +1,283 @@ +# Lab 1 + +## Description and guidelines +You have multiple tasks to complete. You may work with others, however your goal should be on understanding the logic of the flow charts you are creating, and by the end feel comfortable analyzing a problem, breaking it down into steps, and be able to create a flow chart of those ideas. You should also feel comfortable looking at a flow chart and determining if you feel it solves the problem it is for. + +With this lab, you will want to use a unispace font. One way to gain this is to put your answers betwwen lines that contain three ~ characters: + +~~~ +This is a unispace font, notice that +iiii takes up as much space as +wwww. +~~~ + +To draw the boxes, +* Use hyphens for the top and bottom of the statement boxes (you do not need to worry about the sides). +* Use |, +, - to draw the lines. +* Use <, >, ^, or v for the arrow heads. +* Use / and \ for the borders of conditionals (you only need to show the corners, and these do not need to line up.) +* Have your lines that go up do so to the right of your text. + +Example: +~~~ +----------------------- +This is the first step <-----+ +----------------------- | + | | + V | + / \ | + / \ Yes | +/ If something is true \ -----+ +\ and the day is / + a Monday + \ / + \ / + | + |No + v +--------------------- +The last step +--------------------- +~~~ + +## Flowchart Tasks: + +#### Fizzbuzz +* starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz" +~~~ +---------- +Start +---------- + | + v +---------------------------- +Start set initial value at 1 +---------------------------- + |---------------------------------+ + v || ^ +---------------------------- ^| | +Increase Value by 1 || | +---------------------------- || | + | |^ | + V || ^ + / \ || | + / \ || | + / \ Yes || | __________________ +/ Is value divisble by 6 \-----------+|--|----->|Print "Fizz Buzz" | +\ / || | |__________________| + \ / || ^ + \ / ^ ^ | + |No || | + V | + / \ || | + / \ || | + / \ Yes || | ____________ +/ Is value divisble by 2 \-----------+|--|----->|Print "Fizz"| +\ / | | |____________| + \ / | ^ + \ / ^ | + |No | | + V | | + / \ | | + / \ | | + / \ Yes | ^ ____________ +/ Is value divisble by 3 \----------- +--|------>|Print "Buzz"| +\ / | |____________| + \ / | + \ / ^ + |No | + v | + ------------- | + Print value -->------------------------+ + ------------- + | + v +----------- +END +------------ + ~~~ +#### Determine a students letter grade when given the %. +~~~ +---------- +Start +---------- + | + v +--------------------------------- +Enter Students Percentage Grade % +--------------------------------- + | + v + / \ + / \ Yes +------------+ +/ Is value greater \ ----->|Print A | +\ than or equal to 90 / +------------+ + \ / + \ / + | + |No + v + / \ + / \ Yes +------------+ +/ Is value greater \ ----->|Print B | +\ than or equal to 80 / +------------+ + \ / + \ / + | + |No + v + / \ + / \ Yes +------------+ +/ Is value greater \ ----->|Print C | +\ than or equal to 70 / +------------+ + \ / + \ / + | + |No + v + / \ + / \ Yes +------------+ +/ Is value greater \ ----->|Print D | +\ than or equal to 60 / +------------+ + \ / + \ / + | + |No + v + + ------------- + Print F + ------------- + | + v +----------- +END +------------ +~~~ +#### Convert a tempature from C to F or vice versa. +~~~ +---------- +Start +---------- + | + v +------------------------------ +Insert Temperature Value +------------------------------ + / \ + / \ Yes+------------------------+ +----------------- ---+ +/ Is value in Celisus \ ----->|Value* multiply(9/5)+32 |----->|Print "New Value" "F"| +\ / +------------------------+ +---------------------+ + \ / + \ / + | + |No + v +------------------------------- +Value subtract 32 multiply 5/9 +-------------------------------- + | + v +-------------------- +Print "New Value" "C" +--------------------- + | + v +----------- +END +------------ +~~~ +#### When given three numbers return the largest of them +~~~ +---------- +Start +---------- + | + v +--------------------------------- +Assign first number as a +assign second number as b +assign third number as c +--------------------------------- + | + v + / \ + / \ Yes +------------+ +/ Is a greater \ -----> |Print a | +\ than b and / +------------+ + greater c + \ / + \ / + | + |No + v + / \ + / \ Yes +------------+ +/ Is b greater \ --------> |Print b | +\ than a and / +------------+ + greater c + \ / + \ / + | + |No + v + ------------- + Print c + ------------- + | + v +----------- +END +------------ +~~~ + +#### Find the sum of the first 100 numbers +1. modify this to find the sum of the next 100 numbers when given a starting value. +~~~ +---------- +Start +---------- + | + v +----------------------- +Insert initial value=n +----------------------- + |<------------------------------+ + v ^ +---------------------- | +set i=0 | +---------------------- | + | | + v | +--------------- | +increase i by 1 | +--------------- | + / \ | + / \ Yes +-------+-----------------------------+ +/ Is i less \ -----------> |n+(n+1)=n | + |add initial value to initial value +1| +\ than 100 / +-------------------------------------+ + + \ / + \ / + | + |No + v +--------------- +Print n +--------------- + | + v +------------ +END +-------------- + +~~~ + +#### 7. Find the nth fibonaci number +* The 0th and the 1st fibonaci numbers are both 1. +* All other fibonaci numbers equal the sum of the two before it. + So the 2nd fibonaci number is 2, because fib(0)+fib(1) = 1+1 + Also the 10th fibonaci number is fib(8)+fib(9) + +#### 8. Find the largest prime number less than a given number diff --git a/Yesenia_Lopez.md b/Yesenia_Lopez.md new file mode 100644 index 0000000..6f3596e --- /dev/null +++ b/Yesenia_Lopez.md @@ -0,0 +1,48 @@ +~~~ + FizzBuzz + + ------------------------ + This is the first step + ------------------------ + | + V + -------------------- + | Start at n=1. | + | Choose a number p>n| + -------------------- ++-----------> | +| V +| / \ +| / \ Yes -------------- +| |If n is divisible by 2|--------> | Print "Fizz" | +| \ / -------------- +| \ / | +| No | <---------------------------+ +| V +| / \ +| / \ Yes -------------- +| |If n is divisible by 3|--------> | Print "Buzz" |--+ +| \ / -------------- | +| \ / | +| | No | +| V | +| ---------- | +| | Print n | | +| ---------- | +| | <------------------------------------+ +| V +| ----------------------- +| | Increase n by adding 1 | +| ----------------------- +| / \ +| / \ Yes --------- ----------------------- +| /Does n+1=p?\ -------------> | Print p |--------> | This is the last step | +| \ / --------- ----------------------- +| \ / +| \ / +| | No +| V +| --------------- ++-----| Set n=n+1 | + --------------- +~~~ diff --git a/addyvinton.md b/addyvinton.md new file mode 100644 index 0000000..ef23207 --- /dev/null +++ b/addyvinton.md @@ -0,0 +1,136 @@ +number 1 +~~~ +--------------------- +Start at the number 0 +--------------------- + |<---------------------------------------------------------------------------+ + |<------------------------------------------------------------------------+ | + |<----------------------------------------------------------------------+ | | + |<-------------------------------------------------------+ | | | + v | | | | +-------------------- | | | | +Add 1 to the number | | | | +-------------------- | | | | + | | | | | + v | | | | + / \ / \ | | | | + / if\ yes / if\ yes ------------------- | | | + /the number is \--------> /the number is \----------> print "fizzbuzz" | | | + \divisible by 2 / \divisible by 3/ ------------------- | | | + \ / \ / | | | + \ / \ / | | | + | | | | | + | |no | | | + | v | | | + |no --------------- | | | + | print "fizz" +----------------------------------+ | | + | --------------- | | + / \ | | + / if\ yes ---------------- | | + /the number is \--------> print "buzz" +------------------------------------+ | + \divisible by 3/ ---------------- | + \ / | + \ / | + | | + |no | + v | +------------------ | +print the number +-------------------------------------------------------------------+ +------------------ +~~~ + +number 2 + +~~~ + ------- + start + ------- + | + |<-----------------------------------------------------+ + |<--------------------------------------------------+ | + |<------------------------------------------------+ | | + |<---------------------------------------------+ | | | + |<-----------------------------------------+ | | | | +------------------------------------ | | | | | +get input of student's percent grade | | | | | +------------------------------------ | | | | | + | | | | | | + | | | | | | + v | | | | | + / \ | | | | | + / if \ yes ------------- | | | | | + /student's grade is\------------> print "A" +----+ | | | | + \between 90-100 / ------------- | | | | + \ / | | | | + \ / | | | | + | | | | | + |no | | | | + v | | | | + / \ | | | | + / if \ yes ------------ | | | | + /student's grade is\------------> print "B" +--------+ | | | + \between 80-89 / ------------ | | | + \ / | | | + \ / | | | + | | | | + |no | | | + v | | | + / \ | | | + / if\ yes ------------ | | | + /student's grade is\------------> print "C" +------------+ | | + \between 70-79 / ------------ | | + \ / | | + \ / | | + | | | + |no | | + v | | + / \ | | + / if\ yes ------------ | | + /student's grade is\-----------> print "D" +--------------+ | + \between 60-69 / ------------ | + \ / | + \ / | + | | + |no | + v | + / \ | + / if \ yes ------------- | + /student's grade is\--------------> print " F" +--------------+ + \ less than 60 / ------------- + \ / + \ / + +~~~ + + + +number 3 + + +~~~ +--------- +start +--------- + | + | + v +------------------------- +get input of temperature +------------------------- + | + | + v + / \ + / if\ yes + /temperature is Farenheit\--------------> take the temperature - 32 times (5/9) + \ / + \ / + \ / + | + |no + v + + + + +~~~ diff --git a/dburrigh.md b/dburrigh.md new file mode 100644 index 0000000..eac85e9 --- /dev/null +++ b/dburrigh.md @@ -0,0 +1,99 @@ +Fizzbuzz +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------ +Start with the number 1 +------------------------ + | + V +---------------------------- +Add 1 to the previous number <-----------------+-----------+ +---------------------------- | | + | | | + V | | + / \ | | + / \ No ------- | | +/ If the number \ -------> Stop | | +\ is less than n / ------- | | + \ / | | + | | | + |Yes | | + V | | + / \ | | + / \ | | +/ If the number \ Yes ------------------ | + is divisible by both---------------> Print "FizzBuzz" | +\ 2 and 3 / ------------------ | + \ / | + | | + | | + |No | + V | + / \ | + / \ Yes ------------- | +/ If the new number \ -----------------> Print "Fizz" ----+ +\ is divisible by 2 / ------------- | + \ / | + | | + |No | + V Yes -------------- | +/ If the new number \ -------------------> Print "Buzz" --+ +\ is divisible by 3 / --------------- | + | | + |No | + V | +------------------- | +Print out the number ---------------------------------------+ +------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Find the largest prime number less than a given number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------ +Given a number n>1 +------------------ + | + V +------------------------ +Decrease the number by 1 <----------+ +------------------------ | + | | + V | + / \ | + / \ Yes | +/ If the number is \ --------+ + divisible by any +\ number between 1 and n / + (1 fib(i) = 1 +\i = int, when i = 0 or i = 1 / ------------ + \ / + |No + V + / \ Yes ---------------------------- + / when i fib(i)= fib(i-1) + fib(i-2) + and i does ---------------------------- + \ does not equal/ + 0 or 1 + \ / + |No + V +--------------------------- +fib(n) = fib(n-1) + fib(n-2) +---------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/dmonrow_lab_1.md b/dmonrow_lab_1.md new file mode 100644 index 0000000..7fc94e8 --- /dev/null +++ b/dmonrow_lab_1.md @@ -0,0 +1,204 @@ +# Lab 1 + +## Description and guidelines +You have multiple tasks to complete. You may work with others, however your goal should be on understanding the logic of the flow charts you are creating, and by the end feel comfortable analyzing a problem, breaking it down into steps, and be able to create a flow chart of those ideas. You should also feel comfortable looking at a flow chart and determining if you feel it solves the problem it is for. + +With this lab, you will want to use a unispace font. One way to gain this is to put your answers betwwen lines that contain three ~ characters: + +~~~ +This is a unispace font, notice that +iiii takes up as much space as +wwww. +~~~ + +To draw the boxes, +* Use hyphens for the top and bottom of the statement boxes (you do not need to worry about the sides). +* Use |, +, - to draw the lines. +* Use <, >, ^, or v for the arrow heads. +* Use / and \ for the borders of conditionals (you only need to show the corners, and these do not need to line up.) +* Have your lines that go up do so to the right of your text. + +Example: +~~~ +----------------------- +This is the first step <-----+ +----------------------- | + | | + V | + / \ | + / \ Yes | +/ If something is true \ -----+ +\ and the day is / + a Monday + \ / + \ / + | No + v +--------------------- +The last step +--------------------- +~~~ + +## Flowchart Tasks: + +#### Fizzbuzz +* starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz" +~~~ +----------------------- +Insert Desired Number +----------------------- + | + V + / \ |<------------- + / \ | ^ +/ start a var at 1 \ | | +\ / | / \ + \ / | \Add one to var/ + \ / ----------------------------------------------------< | + | No ------- + | / \---------yes > End + | \Is Var euqal to desired Num/ ------- + /Divide var by 2\ | + \Is there a remaineder?\----No---> /print fuzz\ ---------------^ + v | + | | + yes | + | | + /Divide var by 3\ | + \Is there a remainder/-----no-------->/print buzz\------------ + | ^ + yes | + | | + /print Var\ | + \ /-----------------------------------------------^ + +~~~ + +#### Determin a students letter grade when given the %. +~~~ +----------------------- +Insert Percentage +----------------------- + | + V + / \ + / \ +/ Is percentage \ +\ greater than 90% /----yes----->/pint A\ --------------------v + \ / | + \ / | + | | + no | + | | + /Is percentage\ | + \less than 90% but greater\----yes---> /print B\ ---------------v + \than 80%/ | + | | + no | + | | + /Is percentage\ | + \less than 80% but greater\----yes---> /print c\ ---------------v + \than 70%/ | + | | + no | + | | + /Is percentage\ | + \less than 70% but greater\----yes---> /print d\ ---------------v + \than 60%/ | + | | + no | + | | + /Is percentage\ | + \less than 60% but greater\----yes---> /print f\ ---------------v + \than 0%/ | + | + ---------------- + End program + ----------------- +~~~ + +#### Convert a tempature from C to F or vice versa. +~~~ +----------------------- +Incerpt temprature +----------------------- + | + V + / \ + / \ +/ ask if temp is in \ +\ Fahrenheit? /----no----->/Multiply by 9/5 and add 32\ --------/Print equation with F\ + \ / | + \ / ----------v----- + | >----- end program + yes | --------------- + | | + / subtract 32\ | + \and times by 5/9/-------> /print solution with C\ -------------^ + \/ + +~~~ + +#### When give three numbers return the largest of them +~~~ +----------------------- +Insert first Number and set as x +----------------------- + | + V +----------------------- +Insert second Number and set as y +----------------------- + | + V +----------------------- +Insert third Number and set as z +----------------------- + | + V + / \ + / \ +/ is x greater than y and z \ +\ /----yes----->/print x\ -------------v + \ / | + \ / | + | | + no | + | | + / \ | + \ is y greater than x and z\----yes---> /print y\ --------------v + \ / | + | | + no | + | | + /\ | + \ is z greater than y and x\----yes---> /print z\ --------------v + | + | + ---------------- + End program + ----------------- +~~~ + +#### The game of Nim: +* This game is played between two players. +* There are piles of stones, the number of stones in each pile is known. +* Each turn a player can take any number of stones away from a single pile (they must take at least one.) +* The person who takes the last stone from the last remaining pile looses. + +1. Create a flow chart for the optimal move for a player if there is only one pile. +1. Create a flow chart for the optimal move for a player if there are exatly two piles. +1. Can you merge these together to create a flowchart for an optimal move if there are two or less piles? Please do so, if yes. +1. What about if there are any number of piles. + +#### Find the sum of the first 100 numbers + +1. modify this to find the sum of the next 100 numbers when given a starting value. + +#### Find the nth fibonaci number +* The 0th and the 1st fibonaci numbers are both 1. +* All other fibonaci numbers equal the sum of the two before it. + So the 2nd fibonaci number is 2, because fib(0)+fib(1) = 1+1 + Also the 10th fibonaci number is fib(8)+fib(9) + +#### Find the largest prime number less than a given number diff --git a/jackhinze.md b/jackhinze.md new file mode 100644 index 0000000..3b70082 --- /dev/null +++ b/jackhinze.md @@ -0,0 +1,76 @@ +Grade Percentage Problem +~~~ +================================== +Given a student's grade percentage +================================== + | + V + / \ + / \ Yes -------------------- +/If the grade is greater than or\---------> Set student's letter ----------------------+ +\equal to 90% / grade to "A" | + | ---------------------- | + | No | + | | + V | + / \ | + / \ Yes ------------------- | + /If the grade is greater than or\--------> Set student's letter ----------------------+ + \equal to 80% / grade to "B" | + | ---------------------- | + | No | ---------------- + | |-----------> Print student's + V | letter grade + / \ | ---------------- + / \ Yes -------------------- | +/If the grade is greater than or\---------> Set student's letter ----------------------+ +\equal to 70% / grade to "C" | + | -------------------- | + | No | + | | + V | + / \ | + / \ Yes --------------------- | +/If the grade is greater than or\---------> Set student's letter ----------------------+ +\equal to 60% / grade to "D" | + | --------------------- | + | No | + | | + | --------------------- | + +-------------------------> Set student's letter ---------------------+ + grade to "F" + ---------------------- + + ~~~ + + Temperature Problem + +~~~ +==================== +Given a temperature +==================== + | + V + / \ + / \ Yes Yes +/If temperature\----------> /If temperature is\------------------------------------+ +\is in Celsius / \wanted in Celsius/ | + | | | + | No | No | + V | | ----------------- + / \ V |---------------> Print temperature + / \ ------------------------ | ------------------ +/If temperature is \ Take temperature *(9/5) ----------------------------+ +\wanted in Fahrenheit/ then add 32 | + | \ ------------------------ | + No | \ Yes | + | \ | + | +----------------------------------------------------------------+ + | | + ------------------------------- | + Take temperature and subtract ---------------------------------------------------+ + 32, then multiply by (5/9) + ------------------------------ + + ~~~ + diff --git a/jaraujomirandalab1 b/jaraujomirandalab1 new file mode 100644 index 0000000..b282759 --- /dev/null +++ b/jaraujomirandalab1 @@ -0,0 +1,89 @@ + Flowchart number 1 +------------------------------------------------------------------------------------------------------------------------------ + Input (1 + 1*(the amount of loops made) +------------------------------------------------------------------------------------------------------------------------------ + A A A A | + | | | | v + | | | | / \ Yes /\ No /\ No /\ No --------------------- + | | | | / Is the number \------>/ Is the number a \ -------->/ Is the number \----------------->/ Is the number \---------> Print out the number + | | | | \the given number/ \ divisible by 6 / \ divisble by 2 / \ divisible by 3 / --------------------- + | | | | \ / \ / \/ \/ + | | | | | \ / | Yes | Yes + | | | | | | Yes v v + | | | | | v ------------------- --------------------- + | | | | | --------------------- Print out "Fizz" Print out "Buzz" + | | | | | Print out "Fizz Buzz" ------------------ --------------------- + | --------- | | | --------------------- + | Loop | ---------- | + | --------- | Loop v + | | | ---------- / \ + | | | | / \ No /\ No /\ No --------------------- + | | --------- | / Is the number a \ -------->/ Is the number \----------------->/ Is the number \---------> Print out the number + | | Loop | \ divisible by 6 / \ divisble by 2 / \ divisible by 3 / --------------------- + --------- | --------- | \ / \/ \/ | + Loop | | | \ / | Yes | Yes | + --------- | | | | Yes v v | + | | | | v ------------------- --------------------- | + | | | | --------------------- Print out "Fizz" Print out "Buzz" | + | | | +-- Print out "Fizz Buzz" ------------------ --------------------- | + | | | --------------------- | | | + | | +-------------------------------------------------+ | | + | +---------------------------------------------------------------------------------------------------+ | + +----------------------------------------------------------------------------------------------------------------------------------------------------------+ + + +Flowchart number 2 +----------------------- + Input grade +----------------------- + | + V + / \ + / \ Yes /\ No /\ No /\ No ---------------- +/ Is the number \ --------->/ Is it between \----->/ Is it between \------>/ Is it between \--------> The grade is A +\ bigger than 59.9% / \ 60% and 69.9% / \ 70% and 79.9%% / \ 80% and 89.9% / ---------------- + \/ \/ \/ \/ + | No | Yes | Yes | + v v v v +--------------------- -------------------- --------------------- ------------------- + The grade is F The grade is D The grade is C The grade is B +--------------------- -------------------- --------------------- ------------------- + + Flowchart number 3 +----------------------- + Input number +----------------------- + | + V + / \ + / Is \ + / the \ + / number \ + \ in / Yes ----------------------------------------- + \Celsius/ -------> Put the number in (9*(input number)/5)+32 + \ / ----------------------------------------- + \ / + | + | No + v +----------------------------------------- +Put the number in 5*((input number)-32)/9 +----------------------------------------- + + Flowchart number 4 +----------------------- + Input numbers given +----------------------- + | + V + / \ + / \ No /\ No ------------------------- +/ Is the first number \ ------>/ Is the second number \------> Display the third number +\ bigger than the other two / \ bigger than the third number/ ------------------------- + \ / \/ + \ / | Yes + | Yes v + v ------------------- +--------------------- Display that number + Display that number ------------------- +--------------------- diff --git a/kbenes2.md b/kbenes2.md new file mode 100644 index 0000000..da35153 --- /dev/null +++ b/kbenes2.md @@ -0,0 +1,87 @@ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Given a Student's Grade Percentage +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | + V + / \ + / \ ---------------- + / If the percent is \ Yes Student's letter + \greater than or equal to 90%/ -----------> grade is "A" -----------+ + \ / ---------------- | + \ / | + |NO | + V | + / \ | + / \ ---------------- | + / If the percent is \ Yes Student's letter | + \greater than or equal to 80%/ -----------> grade is "B" -----------+ + \ / ---------------- | + \ / | + |NO | + V | + / \ | + / \ ---------------- | + / If the percent is \ Yes Student's letter | + \greater than or equal to 70%/ -----------> grade is "C" -----------+ + \ / ---------------- | + \ / | + |NO | ---------------- + V |------------ Print Student's + / \ | Letter Grade + / \ ---------------- | ---------------- + / If the percent is \ Yes Student's letter | + \greater than or equal to 60%/ -----------> grade is "D" -----------+ + \ / ---------------- | + \ / | + |NO | + | ---------------- | + | Student's letter | + +------------------------------> grade is "F" -----------+ + ---------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +FizzBuzz +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~ +--------------------------------- + Start with 1 +--------------------------------- + | +--------------------------------- + Add 1 <----------------------------+ +--------------------------------- | + | | + V | + / \ | + / \ No ----- | + / If the number \------------> Stop | + \ is less than n / ----- | + \ / | + | Yes | + V | + / \ | + / \ Yes ---------------- | + / If the number is \--------> Print "FizzBuzz"------+ + \ divisible by 2 and 3 / ---------------- | + \ / | + |NO | + V | + / \ | + / \ Yes ------------ | + / If the number \----------> Print "Fizz"----------+ + \ is divisible by 2 / ------------ | + \ / | + |NO | + V | + / \ | + / \ Yes ------------ | + / If the number \----------> Print "Buzz"----------+ + \ is divisible by 3 / ------------ | + \ / | + |NO | + V | + | | + | | + ----------------- | + Print Number -------------------------------------+ + ----------------- +~~~ diff --git a/piiamt.md b/piiamt.md new file mode 100644 index 0000000..9cd21bb --- /dev/null +++ b/piiamt.md @@ -0,0 +1,157 @@ +Fizzbuzz by Piia: +~~~ +---------------------------- +Set initial "number" to 1 +---------------------------- + | ++-------------+ +| | +| / \ +| / if number<= given max\ ----------- +| \ /-------------No--------| End loop| +| \ / ----------- +| | +| Yes +| | +| V +| / \ +| / \ +| /if "number" \ +| \is divisible by 2 /----No---+ +| \ / | +| \ / | +| | | +| Yes | +| | | +| V | +| / \ | +| /if also \ | +| \ divisible by 3/--Yes-+ | +| \ / | | +| | ------------- | +| | print | +| | "FIZZBUZZ" | +| | ------------- | +| | | +| --------------------- | +| Print "Fizz" | +| --------------------- | +| | | +| | /\ | +| | / \ V +| | / if "number" is \ +| | \ divisible by 3 /----------No-----+ +| | \ / | +| | \/ | +| | | | +| | Yes | +| | | -------------------------- +| | V print the "number" +| | --------------------------- -------------------------- +| | print "Buzz" | +| | --------------------------- | +| | | | +| | V V +| | ----------------------------------------- +| +-----------| set number +| | to "number"+1 +| ---------------------------------------- +| | ++------------------------------------+ +~~~ +int givenMax=10 +int number=1 +for (i=0; i>=givenMax; i++, number++){ //sets counter i, stops when counter hits max iterations, after every runthrough increases both i and number by 1. + if (number%2==0 && number%3==0){ + System.out.println("FizzBuzz"); + } + else if (number%2==0){ + System.out.println("Fizz"); + } + else if (number%3==0){ + System.out.println("Buzz"); + } + else{ + System.out.println(number); + } +} + + + + +CELSIUS-FAHRENHEIT by Piia +~~~ +-------------------------- + given temperature +-------------------------- + | | + | | + / \ / \ +/if temp\ /if temp\ +\given in C/ \given in F/ + \ / \ / + | | +---------------- ---------------------- +print print +temp*(9/5)+32 (temp-32)*(9/5) +---------------- ---------------------- +~~~ +float temp=25.3; +boolean isCelcius=true; +if (isCelcius==true){ + System.out.println("The temparature in Fahrenheit is "+(temp*(9/5)+32) ); +} +else{ + System.out.println("The temparature in Celcius is "+(temp-32)*(9/5) ); +} + + + +LARGEST OF THREE NUMBERS by Piia +~~~ +------------------------------- + given three numbers, called + n1, n2 and n3 +------------------------------- + | + | + / \ + /if n1>n2 \ + \ /----No------+ + \ / | + | / \ + Yes /if n2>n3\ + | \ /-------No----------+ + / \ \ / | + / if n1>n3 \ | | + \ / Yes | + \ / | | + \ / --------------- | + \ / print n2 | + \ / ---------------- --------------- + \/-----------------------No---------------|print n3 + | --------------- + Yes + | + ----------------- + print n1 + ----------------- + ~~~ +int n1 = 3; +int n2 = 5; +int n3 = 1; +if (n1>n2){ + if (n1>n3){ + System.out.println("the largest number is n1"); + } + else{ + System.out.println("the largest number is n3"); + } +else if (n1n3){ + System.out.println("the largest number is n2"); + } + else{ + System.out.println("the largest number is n3"); + } +