7. Section A (5 points) a. Debugging process: Minimum element was initially zero, which resulted in a wrong output. Using the debugger to check how For-Loop iterated, I found the initial problem of min = 0 that caused IF statement to be always False. Thus, I changed min=0; to min=num[0] and the program begun to work perfect.
and the second path is where ten is added to the value of the entrance and then the subtraction occurs. On the side you can see a series of logic gates that generate a function that will produce an output of 1 only when digit 1 of the exit is bigger than that of the entrance. This output will be sent to two different multiplexers, one for each digit. In the digit 1 diagram it will be sent to a multiplexer that will decide whether to use the subtraction where the entrance has been increased by 10 or whether to use the other where the entrance has had no alteration. If it is a 1, then it will use the first option where ten was added to the entrance. If it is a zero, then the latter will be used. This can be seen below in figure 2.
So, I went back to the book and looked in chapter two for a while then I went on to chapter three and found on pg. 91 -97 about the if and else statements to create a module. After I played with it for a while and kept getting error messages. I finally realized when I typed if I would type the condition which needed to be int(number) % 2 == 0 : because int is for integer that way the program would know it would be a whole number. The “%” is used in this program because it means remainder or module and I used it for the module part. The double == signs just bean equal I found this on pg. 92. Next on pg. 93 it shows to indent and type your sequence of statements and mine is print(“This si even”). I did this to so when the user types in any even number it will tell they user that it is an even number. Next, when I typed else I hit enter and indented again to type my sequence of statements, which is print(“this is odd”). This is so when the user types in an odd number the program will tell them that it is odd. From our notes I saw how to include the random library which is to type random = random.randint (0, 20000). The first time I entered this I spelled it wrong and immediately received an error message. I went back and changed the spelling and it ran
//*****END OF PIVOT SELECTION CODE************ //divide into two arrays while (left <= right)//while loop will run as long as left is less or equal to right
(Chapter 1, Exercise 2) Solution: FOR EACH i in A[i] j = i + 1 FOR EACH j in A[j] IF A[i] < A[j] THEN temp = A[i] A[i] = A[j] Algorithm 2: • Definition of Basic Operation: We are using two FOR Loop to traverse the input and create a 2 dimensional array for printing the output.
Assignment 3 Name: Narendra Kumar Reddy Mule 700#:700622719 3.1 Using the program shown in Figure 3.30 explain what the output will be at Line A.
4. The calculation should be executed only after all the valid input values are provided.
ASSESMENT – 3 PITIPANA ACHCHIGE JAYANI SASIKALA SOMAWEERA STUDENT ID-11583662 COMPUTER ORGANISATION AND ARCHITECTURE (ITC544) 1. a) b) c) 2. ORG 100 Load Addr /Load address of first number to be added Store Next /Store this address is our Next pointer Load Num /Load the number of items to be added Store Counter /Store this value in Counter to control looping Loop, Load Sum /Load the Sum into AC AddI Next /Add the value pointed to by location Next Store Sum /Store this sum Load Next /Load Next Add One /Increment by one to point to next address Store Next /Store in our pointer Next Load Counter /Load the loop control variable Store Counter /Store this new value in loop control variable Skipcond 000 /If control variable >= 0, skip next instruction Jump Loop /Otherwise, go to Loop Halt /Terminate program Addr, Numbers to be summed start at location 0 Next, A pointer to the next number to add Num,/The number of values to add Sum, Dec 0 /The sum Counter, Hex 0 /The loop control variable One, Dec 1 /Used to increment and decrement by 1 Dec 10 /The values to be added together Dec 10 Dec 20 Dec 30 Dec 40 Dec 50 3. a.) Number of Rows = 256 *1024*1024 = 262144 As such, The particular consideration in the advertising plus the imagination in the general public include grabbed by it. During the last few years,Cell phone devices have received dramatical increase as well as there are at present close to a pair of billion dollars usersworld-wide. Indeed, in many formulated countries, cellular phones are getting to be an essential company deviceas well as a part of everyday life, as well as in many creating countries, cellular phones tend to be easily supplantingantiquated wireline
Operating Systems are complex pieces of software that are designed for powerful hardware, easily capable of running many programs at once, the prioritize hardware task requests known as ‘system calls’ and allocate them memory space or processing time as needed.
to each character moving from right to left. 2. Sum the digits in all odd positions, and multiply the result by 3. 3. Sum the digits in all even positions. 4. Sum the totals calculated in step 2 and 3. 5. The check digit is the number which, when added to the total calculated in step 4, result in a
Multiple assignments can be made in one statement with the syntax: x, y, z = "Python", 127.5, 54 In the above assignment statement, the variable x holds the string “Python”, y holds the float 127.5, and z holds the integer 54.
- double payrate = 12.50; e. Copy the value from an existing int variable firstNum into an existing int variable tempNum.
Home Work -1 2.9) Write a single statement or line that accomplishes each of the following a) Print the message “Enter two numbers”. Answer:
ensure they return to their families every evening after school.(More research on this opposition following) 234232 44 44 3 4 3 2 3 4 54 5 5 6 7 3 4 6 3 4 5 4 3 5345 7 7 6 7 8 7 7 6 7 6 7 6 6 5 6