Ask Question
5 August, 18:48

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.

+4
Answers (1)
  1. 5 August, 19:53
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers