How to take input from the user in TCL

puts -nonewline "Enter number to factor: "

#puts "Enter number "

set num [gets stdin]

for {set i $num} {$i>0} {incr i -1} {

if { $num % $i == 0 } {

puts $i

}

}