identification division.

       program-id.  varyingbadIFcondname.

       data division.

       working-storage section.

       77  rank  pic 9.

       77  temp  pic 99.

       77  letter-grade pic a.

       01  rank-student-avg  pic 999.

           88 rank-high      value 80 thru 100.

           88 rank-middle    value 50 thru 79.

           88 rank-low       value 0 thru 49.

 

       procedure division.

 

       100-example-badIF.

    ***** enter values for rank from 0 to 9 to determine the output for each value

    ***** will need to run this portion of code 10 times (1 for each input value)

    ***** notice the stop run to help you do this!

  display "enter rank (valid 1-8)".

        accept rank.

        if rank <= 4

            if rank >= 1

                display "undergrad"

        else if rank > 4

            if rank <=8

                display "grad student"

        else

                display "error in rank value".

        accept omitted.

 *      stop run.

 

       200-example-cond-names.  

    ***** how will you enter the input data? Ex. 85 or 085?!

    ***** what is the output for this portion of code

    ***** that is, what is displayed to the screen?

           display "enter student average format 999"

           accept rank-student-avg.

           if rank-high move "A" to letter-grade.

           if rank-middle move "B" to letter-grade.

           if rank-low move "C" to letter-grade.

           display "letter grade is " letter-grade.

           accept omitted.

 

       300-example-varying.

    ***** what is the output to the screen?!

           perform varying temp

               from 1 by 1 until temp = 10

                   display "in loop" temp

           end-perform.

           display "after loop" temp.

          

           perform with test before varying

               temp from 1 by 1 until temp = 10

                   display "in loop" temp

           end-perform.

           display "after loop" temp.

          

           perform with test after varying

               temp from 1 by 1 until temp = 10

                   display "in loop" temp

           end-perform.

           display "after loop" temp.

 

           accept omitted.

           stop run.