You are viewing a single comment's thread. Return to all comments →
what if the value I give is a=8 and b=5?
You will be given two positive integers, a and b (a<=b), separated by a newline.
read the question first .....AH
calm down okay! It was just a mistake. Sorry that I asked you.
Good practice would be to not assume such things, so your intuition is spot on. A simple check at the beginning of the function hurts nothing, as so...
int a, b;
cin >> a;
cin >> b;
if((b - a) < 0)
return 0; //or whatever other error handling is needed
you are right .