Download presentation
Presentation is loading. Please wait.
Published byLaurel Wilkerson Modified over 9 years ago
2
START DECLARE num AS integer array of size 10 DECLARE count AS integer FOR count ← 1 TO 10 num[count] ← count * 2 ENDFOR STOP Trace table headed as follows: countnum 12345678910
3
countnum 12345678910 12 224 3246 42468 52468 62468 12 72468101214 8246810121416 924681012141618 102468 1214161820
4
START DECLARE num1, num2 AS integer array of size 5 DECLARE count AS integer FOR count ← 1 TO 5 num1[count] ← count num2[count] ← num1[count] * num1[count] ENDFOR STOP
5
countnum1num2 1234512345
6
countnum1num2 1234512345 111 21214 3123149 4123414916 512345149 25
7
START DECLARE num1, num2, ans AS integer array of size 4 DECLARE count AS integer FOR count ← 1 TO 4 num1[count] ← count num2[count] ← count + count ans [count] ← num1[count] + num2[count] ENDFOR STOP
8
countnum1num2ans 123412341234 1123 2122436 3123246369 41234246836912
9
START DECLARE SIZE AS constant integer with value 7 DECLARE num1 AS integer array of size SIZE DECLARE count AS integer FOR count ← 1 TO SIZE IF count MOD 2 == 0 THEN num1[count] ← count * 2 ELSE num1[count] ← count * 3 ENDIF ENDFOR STOP
10
SIZEcountnum 1234567 713 7234 73349 743498 75349815 763498 12 773498151221
11
START DECLARE SIZE AS constant integer with value 4 DECLARE cost AS integer array of size SIZE DECLARE discount AS real array of size SIZE DECLARE count AS integer FOR count ← 1 TO SIZE discount[count] = cost[count] * (10/100) ENDFOR STOP Cost will have the values --- 12, 5, 10, and 60
12
Someone writes answer on the board.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.