1 / 9

Logic Problems

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

daisy
Download Presentation

Logic Problems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 Y Stop 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 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

  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 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

More Related