we provide information about gadget news and price information and specs samsung, huawei, Tecno Price products, Specifications, Features and more information about software from blackberry and android

Sunday, December 16, 2012

Tcl and OTcl Tutorial for NS2 - Program to find Factorial

Tcl and OTcl Tutorial for NS2 - Program to find Factorial - Did you know that every day there is always a new technology that is created? if you want to know please refer to the blog Gadget News well now we will discuss first about Tcl and OTcl Tutorial for NS2 - Program to find Factorial as you need now, we have compiled this article carefully, so please see to finish.

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://profsmythe.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"



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

hopefully the information Tcl and OTcl Tutorial for NS2 - Program to find Factorial that we provide can be useful for you to know the development of technology in the present

articles Tcl and OTcl Tutorial for NS2 - Program to find Factorial we have conveyed to you, if feel this information is useful and you want to bookmark or share so that more people who know please use link https://profsmythe.blogspot.com/2012/12/tcl-and-otcl-tutorial-for-ns2-program.html.

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

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

0 comments:

Post a Comment