Hello people I have something like this
Two integers for example :
int priceSell = 10;
int priceBuy = 5;
how can I check if the range is no more than 10 % between those numbers ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
-No division by 0
By the way, this answer makes sure the buy price is within 10% of the sell price. The other answer makes sure the sell price is within 10% of the buy price.
And yes, that matters. 90 is within 10% of 100, but 100 isn’t within 10% of 90.(10% range of 100 is 90-110. 10% range of 90 is 81-99)