For an assignment, a small portion of it indicates that an integer must only be five digits long. If an integer is entered such as 1234567, then the result should be 34567.
Is there any way that I can set this directly with scanf? Of course, setting it to only read five integers is easy, but it won’t read the right-most five. Is there a flag or something that can be set for this, or do I have to do some hackish loops afterwards?
You could use the mod operator.
int m = enteredNumber % 100000;This will truncate your number down.Here.. I tried it.