Presentation is loading. Please wait.

Presentation is loading. Please wait.

P ROGRAMMING T ECHNIQUES : L OOPING, C OUNTING AND I NDEXING L ECTURE 7 Gunjeet Kaur Dronacharya group of Institutions.

Similar presentations


Presentation on theme: "P ROGRAMMING T ECHNIQUES : L OOPING, C OUNTING AND I NDEXING L ECTURE 7 Gunjeet Kaur Dronacharya group of Institutions."— Presentation transcript:

1 P ROGRAMMING T ECHNIQUES : L OOPING, C OUNTING AND I NDEXING L ECTURE 7 Gunjeet Kaur Dronacharya group of Institutions

2 L OOPING, COUNTING AND I NDEXING Continuous loop-repeat task continuously Conditional loop-repeats a task until certain data conditions are met. Flowchart of continuous loop

3 L OOPING, COUNTING AND I NDEXING Looping-In this technique, the program is instructed to execute certain set of instructions repeatedly to execute a particular task number of times. Counting-This technique allows programmer to count how many times the instruction/set of instructions are executed. Indexing-This technique allows programmer to point or refer the data stored in sequential memory location one by one.

4 Start Initialization Data Acquisition Data Processing Temporary storage of partial results Getting ready for next operation Decision Making. Are all operations complete? Output Stop Yes Generalized programming flowchart

5 D IVISION OF TWO 8-B IT N UMBERS LDA 2000H ;divisor MOV B,A LDA 2001H ;dividend MVI C, 00H LOOP: CMP B JC BRANCH SUB B INR C JMP LOOP BRANCH: STA 3000H ;reminder MOV A,C STA 3001H ;quotient HLT

6 ARRANGE DATA ARRAY IN ASCENDING ORDER LXI H,2000 MOV C,M DCR C REPEAT: MOV D,C LXI H,2001 LOOP: MOV A,M INX H CMP M JC SKIP MOV B,M MOV M,A DCX H MOV M,B INX H SKIP: DCR D JNZ LOOP DCR C JNZ REPEAT HLT


Download ppt "P ROGRAMMING T ECHNIQUES : L OOPING, C OUNTING AND I NDEXING L ECTURE 7 Gunjeet Kaur Dronacharya group of Institutions."

Similar presentations


Ads by Google