Tech News Today, Marshmallow Custom Rom, Huawei, Run Programs, Network, Chromebook, Bank Account

Minggu, 16 Desember 2012

Tcl and OTcl Tutorial for NS2 - Program to find Factorial

Tcl and OTcl Tutorial for NS2 - Program to find Factorial - To all visitors of this blog, I say welcome and thank you for visiting the blog Tech News Today Look for all the things you need that are available on this blog. If not available, please leave suggestions and comments for the development of this blog. now we will discuss first about Tcl and OTcl Tutorial for NS2 - Program to find Factorial we have collected a lot of information from sources to create this article, so please see.

Articles : Tcl and OTcl Tutorial for NS2 - Program to find Factorial
full Link : 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://sihanandi.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"



information Tcl and OTcl Tutorial for NS2 - Program to find Factorial has been completed in the discussion.

hopefully the article we give the title Tcl and OTcl Tutorial for NS2 - Program to find Factorial can provide knowledge for you in living everyday life in determining the gadget that suits your needs.

you just read the article about Tcl and OTcl Tutorial for NS2 - Program to find Factorial if this article is useful for you and want to bookmark it or share it please use the link https://sihanandi.blogspot.com/2012/12/tcl-and-otcl-tutorial-for-ns2-program.html thank you and do not forget to comment if anyone.

Tag :
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : Tcl and OTcl Tutorial for NS2 - Program to find Factorial

0 komentar:

Posting Komentar