Sunday, January 21, 2018

[Bioinformatics 101] 007. Function Method



Hello! This is Kenneth J Han!

In this post, we are going to look at function (or method).




007. Function Method

Problem

Create a function (or a method) called Factorial.
The Factorial has one integer parameter "num" and returns factorial value of "num".
Calculate the value of 3 factorial, 4 factorial and 5 factorial.

Pseudocode

Factorial(num)
    result ← 1
    WHILE num > 0
        result ← result * num
        num ← num - 1
    RETURN result

result3 ← Factorial(3)
result4 ← Factorial(4)
result5 ← Factorial(5)

PRINT result3, result4, result5

Answer

6  24  120


If you have difficulties solving problem, visit the links below!
Your source code is on ready to serve!

Python source code answer on Github
Java source code answer on Github








See you on next post!

1 comment:

  1. Ignition doesn’t provide telephone support, however new sign-ups can anticipate white-glove service by way of live chat and email. Ignition Casino is primarily known for the 24/7 poker site, however its collection of free-play machines and “Hot Drop Jackpots” is guaranteed to keep slot fanatics occupied. Lag is non-existent, and you’ll get to 카지노 사이트 get pleasure from an equivalent gaming expertise on desktop or cell.

    ReplyDelete