Exam2 WSQ13

Well kind of late but here are my codes from the partial exam,  I will leave links for my codes in Github, hopefully you’ll find useful.

  1. Write a function called triangles which receives a single parameter (int) which represents the size of a triangle. The function should print a triangle using loops (for or while). The only characters printed here are ‘T’ and the new-line character. The first line is length one, the middle line is length size and the last line is length one. Link to GitHub

Captura de pantalla 2016-04-27 a las 9.54.41 p.m..png

  1. Write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power of the second, which is to say it returns a^b. Link to GitHub

    Captura de pantalla 2016-04-27 a las 9.59.14 p.m..png 

  2. Write a function called fibonacci which receives a long “n” and returns a long which is the value of the nth number in the fibonacci series which is: 0,1,1,2,3,5,8,13,21,34,55,89…………
    So, fibonacci(0) would return 0. fibonacci(5) would return 5, fibonacci(8) would return 21.
    Note that the first two fibonacci numbers are 0 and 1.
    All others are the sum of the previous two fibonacci numbers. Link to GitHub

    Captura de pantalla 2016-04-27 a las 10.02.25 p.m..png

  1. Write a function called isPalindrome which receives a string “x” and returns true if the string x is a palindrome, otherwise false. Lint to GitHub

    Captura de pantalla 2016-04-27 a las 10.04.27 p.m..png

Lists WSQ10

Hello everyone! this WSQ is different, well kind of, what to d0:

Create a program that asks the user for 10 numbers. Store those numbers in a list. Show to the user the total, average and standard deviation of those numbers. I found some very useful videos and tutorials:

 

Captura de pantalla 2016-04-07 a las 10.40.28 a.m.

 

Captura de pantalla 2016-04-07 a las 10.37.25 a.m.

Well finally this is the link for my code in GitHub.

 

Factorial calculator WSQ09

Hi everyone! I know that i haven’t blog in a while but I’m back!

What to do?

Create a program that asks the user for a non-negative integer (let’s call that number n) and display for them the value of n! (n factorial). After showing them the answer, ask them if they would like to try another number (with a simple y/n response) and either ask again (for y) or quit the program and wish them a nice day (if they answered n).

Well first of all you need to instal some stuff, the big integer library, at least that was my case, here you have de link for the page BigInteger Library.

Also I recommend you to watch Ken’s video about this, this video is for the last semester, but it might help you.

 

Finally this is my link to my GitHub for my code.

Captura de pantalla 2016-04-07 a las 12.33.01 a.m.