IHYPRESS PROGRAMMING
CGI/Ruby programs with code and output for beginners
classic asp
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Ruby (CGI Programming) ❯ Conditional Loops
<06>
#!/usr/bin/ruby -w print "Content-type: text/html\n\n" puts "<html><body style=\"font-size:2.0em;color:blue;\">" count = 1 while count <= 25 puts count.to_s + " " count = count + 1 end puts "<br><br>" #Calculate the highest power of two less than 10000 number = 1 while number < 10000 number = number * 2 end number = number / 2 puts number.to_s + " is the highest " +\ "power of 2 less than 10000" puts "</body></html>";
Hergestellt in Deutschland / Made in Germany
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

8192 is the highest power of 2 less than 10000
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland