In a data encryption system designed for transmitting telemetry readings, each digit character is obfuscated by replacing it with its '9s complement' (for example, the character '3' is replaced by '6', and the character '0' is replaced by '9').
Write a subroutine COMPLEMENT_DIGIT, using either pseudo-code or a flowchart, that takes a single digit character as a parameter and returns the corresponding 9s complement character.
For example, if the subroutine COMPLEMENT_DIGIT is passed the character '2' as a parameter, the subroutine should return the character '7'.
You should make use of the built-in subroutines INT_TO_CHAR and CHAR_TO_INT in your answer:
CHAR_TO_INT(character) returns the integer ASCII/Unicode code for a character (e.g., CHAR_TO_INT('0') returns 48, CHAR_TO_INT('9') returns 57).INT_TO_CHAR(integer) returns the character corresponding to that ASCII/Unicode code (e.g., INT_TO_CHAR(53) returns '5').You can assume that the parameter passed to the subroutine will always be a single digit character between '0' and '9'.
131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.