Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic Problems This is an assignment. There are no speaker notes.

Similar presentations


Presentation on theme: "Logic Problems This is an assignment. There are no speaker notes."— Presentation transcript:

1 Logic Problems This is an assignment. There are no speaker notes.

2 Assume that you have the following memory variables: var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 6 3 9 2 11 2 91 48 66 1 Follow the flowchart on the next slide and determine the answer. Note: the style of the flowchart is not the conventional flowchart style I want you to use when writing flowcharts, but the logical flow is still there. When I refer to an instruction number, count instructions, the first instruction after the start is instruction 1 etc.

3 Start Add: (number in var4) + (number in var2), put result into var7 Add: (number in var7) + (number in the variable whose number is in var6), put result into var6 Multiply: (number in var6) by (number in var1), put result into var5 Show the number that is now in var5 Stop

4 Assume that you have the following memory variables: var1 var2 var3 var4 var5 var6 var7 var8 3 7 2 1 5 12 4 0 Follow the flowchart on the next slide and determine the answer. Note: the style of the flowchart is not the conventional flowchart style I want you to use when writing flowcharts, but the logical flow is still there. When I refer to an instruction number, count instructions, the first instruction after the start is instruction 1 etc.

5 Start Put (number in var8) into var1 Add: (number in var1) + (number in var2), put result into var1 Change instruction 2: increase the second variable number mentioned in it by 1 Is the second variable number mentioned in instruction 2 greater than (number in var7) Show the number that is now in var1 Stop Y N

6 Assume that you have the following memory variables: var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12 2 1 1 4 6 5 2 12 5 19 1 0 Follow the flowchart on the next slide and determine the answer. Note: the style of the flowchart is not the conventional flowchart style I want you to use when writing flowcharts, but the logical flow is still there. When I refer to an instruction number, count instructions, the first instruction after the start is instruction 1 etc.

7 Start Add: (number in var3) + (number in the var whose num is in var8), put the result into var4 Multiply: (number in var7) by (number in var7), put result into var7 Add: (number in var4) + (number in var1), put result into var4 Is: number in var4 = number in var9 Subtract: (number in var7) - (number in var2), put result into var7 Add: (number in var3) + (number in var9), put result into var10 Subtract: (number in var7) - (number in var10), put result into var11 Show the number that is now in var11 Stop N Y

8 Assume that you have the following memory variables: var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12 var13 9 8 5 2 11 3 5 12 5 -2 4 -6 6 Follow the flowchart on the next slide and determine the answer. Note: the style of the flowchart is not the conventional flowchart style I want you to use when writing flowcharts, but the logical flow is still there. When I refer to an instruction number, count instructions, the first instruction after the start is instruction 1 etc.

9 Start Subtract: (number in var7) - (number in the variable whose number is in var6), put result into var12 Add: (number in var12) + (number in var13), put result into var12 Is (number in var12) exactly divisible by 5 Y N Change Instruction 2: decrease the second variable number mentioned in it by (number in the variable whose number is in var11) Is (number in var2) less than the second variable number mentioned in instruction 2 Y Subtract: (number in var9) -1, put result into var9 A N A Show the number that is now in var12 Stop


Download ppt "Logic Problems This is an assignment. There are no speaker notes."

Similar presentations


Ads by Google