#! /usr/bin/csh -f if ( ${#argv} < 1 ) then /usr/bin/echo "You forgot the number: \c" set num = "$<" else set num = "${argv[1]}" endif set numok = `expr "${num}" : '^[ ]*[0-9][0-9]*[ ]*$'` if ( ! ${numok} ) then echo "Can't compute the sqrt of ${num}\!" exit 1 endif @ num = "${num}" @ sqrt = 0 while ( ( ${sqrt} + 1 ) * ( ${sqrt} + 1 ) <= ${num} ) @ sqrt = ${sqrt} + 1 end echo "floor(sqrt(${num})) = ${sqrt}" exit 0