It's UWAweek 50

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 2 articles in this topic
Showing 2 of 834 articles.
Currently 3 other people reading this forum.


 UWA week 38 (2nd semester, week 8) ↓
SVG not supported

Login to reply

👍?
helpful
4:08pm Tue 17th Sep, ANONYMOUS

I used a random number 24096 to test question 5 from the mid-semester test, and for both options a and d the output was 9 (which is the correct output in both cases). Can anyone tell me why option d is wrong or is their two solutions?



This article has 1 attachment:

 

SVG not supported

Login to reply

👍?
helpful
6:43am Wed 18th Sep, Joshua N.

ANONYMOUS wrote:
> I used a random number 24096 to test question 5 from the mid-semester test, and for both options a and d the output was 9 (which is the correct output in both cases). Can anyone tell me why option d is wrong or is their two solutions?
Option d is wrong. You just had a lucky number choice where the result is the same. If you first divide by ten you perform integer division and so the result becomes 2409, modulo 100 gives 09, which is 9 in this case. A is correct. modulo 100 gives you the reminder of dividing by 100: 96 which is the tens and ones digit. dividing by ten removes the ones digit giving 9. If you try another number such as 2416, "a" will always give the tens digit (1), but "d" will give 41 in this case. You need to choose the option that is guaranteed to give the tens digit, which is option "a".

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy