Looping and Skipping

Sort by

recency

|

257 Discussions

|

  • + 0 comments
    for((i=1; i<=99; i++))
    do
      if (( i % 2 == 1 ))
      then
        echo "$i"
       fi
    done
    
  • + 0 comments

    Looping is a fundamental concept that allows code to be executed repeatedly based on a condition. Common loop structures include for, while, and do-while. They are used to iterate through collections, perform repetitive tasks, or execute code until a certain condition is met. Cricbet99.Green

  • + 0 comments

    for i in {1..99} do if [[ i; fi done

  • + 0 comments

    Practice with while loop

    i=1
    while [ $i -lt 100 ]
    do
        if [ `expr $i % 2` -ne 0 ];
        then
            echo $i
        fi;
    i=`expr $i + 1`
    done
    
  • + 0 comments

    for i in {1..99} do if ((i fi done