Submitted Questions

  • Write a shell script that accept 7 numbers in loop

    write a shell script that accept 7 numbers in loop,then make a sum of this numbers. then count the numbers that are greater than 250 ?

    satish

    • Jul 10th, 2013

    "perl total=0 for a in 1 ...

    ardiansyah

    • Jul 5th, 2012

    Code
    1. #!/bin/bash
    2. total=0
    3. c=0
    4. for a in {1..3};
    5.   do
    6.         echo -n "Write a number : "
    7.         read i
    8.         if [ $i -ge 250 ] ; then let "c=c+1"
    9.         fi
    10.         let "total = i + total"
    11.   done
    12. echo "total = $total"
    13. echo " > 250 = $c "