Perl 编程/练习 8
外观
< Perl 编程
COUNTING THE NO: OF ENTRIES AND THE TOTAL 程序
#!/usr/bin/perl $total = 0; $count = 0; do { print ("Enter a number 0 to quit : "); $value = <>; chomp ($value); $total = $total + $value; if ($value != 0) {$count++;} } while ($value != 0); print ("\nNumber of entries : $count"); print ("\nTotal : $total\n");