Ask 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 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.

+2
Answers (1)
  1. 15 March, 23:46
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers