Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

prime number between 1-100

#!/usr/bin/tclsh

 for {set x 2} {$x<100} {incr x} {
    set flag 1
    for {set i 2} {$i<$x} {incr i} {
        set y [expr $x % $i]
        if {$y == 0}  {
            #puts "$x: not a prime no"
            set flag 0
            break   
        }
    }

    if {$flag ==1} {
        puts "$x: prime no"
    }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.