Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 1.27 KB

loops.md

File metadata and controls

22 lines (17 loc) · 1.27 KB

#Loops

###Resources

For loops

While loops

###Exercises

  1. Write a method that prints the numbers 1 through 10 using a loop.
  2. Write a method that prints the numbers 1 through 10 using a different kind of loop.
  3. Write a method that takes in an int n and prints the numbers 1 through n.
  4. Write a method that takes in an int n and prints the even numbers 2 through n.
  5. Write a method that prints the sum of 1 through 10 using a loop.
  6. Write a method that takes in an int n and prints the sum of the numbers 1 through n using a loop.
  7. Use the method you wrote in part 6 to print the sum of the numbers from 1 through 10000.
  8. Write a method that takes in an int n and a String s and prints out s on its own line, n times. If n is negative, print "".
  9. Modify the method to print out the string concatenated with itself n times.
  10. Write a method that prints the first ten Fibonnaci numbers.
  11. Modify the method to sum the first ten Fibonnaci numbers.
  12. Modify the method to take in an int n and sum the first n Fibonnaci numbers.