90 likes | 174 Views
Logic Problems. This is an assignment. There are no speaker notes. Assume that you have the following memory variables:. var1 var2 var3 var4 var5 var6 var7 var8 var9 var10
E N D
Logic Problems This is an assignment. There are no speaker notes.
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.
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
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.
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 Y Stop N
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.
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 Is: number in var4 = number in var9 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 Y Stop N Add: (number in var4) + (number in var1), put result into var4 Subtract: (number in var7) - (number in var2), put result into var7
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.
Start A Subtract: (number in var7) - (number in the variable whose number is in var6), put result into var12 Show the number that is now in var12 Add: (number in var12) + (number in var13), put result into var12 Stop Y Is (number in var12) exactly divisible by 5 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 Subtract: (number in var9) -1, put result into var9 Y N A