Tcl and OTcl Tutorial for NS2 - Program to find Factorial

Tcl and OTcl Tutorial for NS2 - Program to find Factorial - welcome to our blog Techno Live, now we will discuss information about the Tcl and OTcl Tutorial for NS2 - Program to find Factorial, our admins on this blog has been around to collect information you are looking for so that we usakan to display complete information for you, and in this blog, you can also search for other information, ok please continue reading may be easily understood:

This is about : Tcl and OTcl Tutorial for NS2 - Program to find Factorial
And this article : Tcl and OTcl Tutorial for NS2 - Program to find Factorial

You can also see our article on:


    Tcl and OTcl Tutorial for NS2 - Program to find Factorial



     Fractorial Computation: tcl script to obtain the value of 10! = 10 * 9 * ... * 1.

    1. get  http://liveeconcerts.blogspot.com /" rel="nofollow" target="_blank">factorial.tcl and run the script;
    2. write a function to compute 2^x, test your answer.
    Execute the script as:

    $ tclsh lab1a.tcl
    or
    $ ns lab1a.tcl



    ################################################################################


    #filename : factorial.tcl
    # define function to compute Factorial X!
    proc Factorial {x} {
        # define variable
        set result 1
       
        # for loop
        for {set i 1} {$i <= $x} {incr i} {
    set result [expr $result * $i]
        }
       
        # return computation result
        return $result
    }


    #############################################################################


    # define function to compute 2^x
    proc 2pow {x} {
        # define variable
        set result 1
       
        # for loop
        for {set i 1} {$i <= $x} {incr i} {
    # fill in here
        }
       
        # return computation result
        return $result
    }
    # make function call
    set result [Factorial 10]

    # output result
    puts "$result"

    # make function call
    set result [2pow 10]

    # output result
    puts "$result"


    Articles Tcl and OTcl Tutorial for NS2 - Program to find Factorial finished we discussed

    A few of our information about the Tcl and OTcl Tutorial for NS2 - Program to find Factorial, I hope you can exploit carefully

    No've You've finished reading an article on Tcl and OTcl Tutorial for NS2 - Program to find Factorial and many articles about modern home in our blog this, please read it. and url link of this article is http://liveeconcerts.blogspot.com/2012/12/tcl-and-otcl-tutorial-for-ns2-program.html Hopefully discussion articles on provide more knowledge about the world of tech gadgets.

    Tag :

    Related Posts :

    0 Response to "Tcl and OTcl Tutorial for NS2 - Program to find Factorial"

    Post a Comment