March 8th, 2013, 07:42 AM
Training task question
I'm a new C student and i got a problem with one of my training tasks.
I need to make simple code that will check in a number like 10 - 11 - 12 - 13 - 14 - 15 and so on until 99.
I need to check if the first number is smaller than the second. Like 15. I need to check that 1 is smaller than 5.
Forgive my spelling or lack of words English is not my home language.
Thanks in advance!
March 8th, 2013, 09:20 AM
What exactly is your question? Surely you don't expect someone to do the work for you? Show what you have so far.
It can be done arithmetically (by treating the input as a number) or by character comparison (by treating the input as a string of characters).
Mathematically, you can compare the integer division of the number by 10 with the modulo 10 (remainder of division by 10) of the number.
By character code comparison, you simply compare the first character to the second.
Comments on this post
March 8th, 2013, 09:23 AM
of course I did not expected a solution. I had no idea how to handle it and you helped a lot :D thank you!