Logic 2

Problem #1: Write the program for the first problem in the logic assignment.

  var1 = 10
  var2 = 20
  wksum = 0
  rslt = 0
  do while var2 < 30
     wksum = var1 + var2
     if wksum > 30
        var1 = var1 - 2
        var2 = var2 + 1
        var1 = var1 - 1
        var2 = var2 + 3
     end if
  end while loop
  rslt = var1 + var2
  display rslt

Problem #2: Write a program to take in five scores fom a game and calculate the average. You need to use a loop and inside the loop you prompt for the scores (one score with each pass through the loop)and add it to a total. I want you to go through the loop 5 times so that you get a average for 5 scores. When the loop is complete, figure out the average and display it on the screen.

Problem #3: Redo the program above but instead of doing it 5 times, due it until the total is greater than 500. I want you to then display the average.

Problem #4: Redo the program one more time.This time I want you to have a loop that will take in the score and I want the loop to end when the user types in 000 to say that there are no more scores to report. When the user ends the loop, print out the average.

Problem #5: You have a product that is on sale. Each day of the sale, the price drops 10% from its previous price. The sale lasts for 4 days. You should write a program that processes this problem using a loop. Each pass through the loop should generate the sale price for a a day of the sale and display that price along with the day number.