Ask Question
4 May, 08:52

Suppose someone tries to store into a single integer a student number and a student percentage score for a certain exam. For example, the integer 10085 might be used to store the fact that student number 100 received the value 85 on a certain exam. For example, the integer 876597 might be used to store the fact that student number 8765 received the value 97 on a certain exam. Assuming no one scored more than 99 on a certain exam and assuming you will receive data with atleast three digits or more so the student number and percentage score always both exist, write code that reads in a single integer value and then breaks this packed integer into its two fields, the student number and the student percentage score.

+3
Answers (1)
  1. 4 May, 10:54
    0
    If you divide the number by 100, you will get the student number, because you will get rid of the last two digits. If you multiply the student number by 100, you will get a number starting with the student number, and you can subtract that from the input to get the score.

    Example:

    S = 35578

    number = 35578 / / 100 = 355

    score = 35578 - 35500 = 78
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose someone tries to store into a single integer a student number and a student percentage score for a certain exam. For example, the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers