How do you check whether a string is palindrome or not using TCL script?
Answer Posted / g
set a malayalam
set b [string length $a]
set c [split $a ""]
set b [llength $c]
set b1 [expr {$b-1}]
for {set i [expr {$b-1}]} {$i>=0} {incr i -1} {
lappend new [lindex $c $i]
}
if {$new==$c} {
puts "Palinadrome"
} else {
puts "NO paliandrome"
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers