smartguy595
chetan2u
faifai0714
If a equals the sum of the even integers from 2 to 20, inclusive, and b equals the sum of the odd integers from 1 to 19, inclusive, what is the value of a - b ?
A. 1
B. 10
C. 19
D. 20
E. 21
Hi,
Another way..
Without getting into the sum etc, the answer can be found easily...
2-20 contains 10 integers and similarily 1-19 also has 10 integers..
smallest integer of a is greater by 1 than the corresponding integer of b.. and these is same for all 10 integers..
so a-b=1*10=10
how to count number of odd integers from 1 to n inclusive? Please advise
Hi,
If n is odd, add 1to it and divide by 2...
If n is even, straight way divide by 2...
In this example, n is 19.. Add one,so 20..
20/2=10..
smartguy595, at times it might be that you are given some integer in between to another integer ahead..
example, it may not be 1 to n, but n to x..
few points to note in that scenario..
1) both x and n are eventotal integers will be (x-n)+1...
even will be 1 more than odd..
even= (x-n)/2+1 and odd=(x-n)/2..
2) x is even and n is odd..total integers = x-n +1..
even will be equal to odd..
even= odd={(x-n)+1}/2 ..
3)x is odd and n is even..total integers = x-n +1..
even will be equal to odd..
even= odd={(x-n)+1}/2 ..
4) both x and n are oddtotal integers will be (x-n)+1...
odd will be 1 more than even..
odd= (x-n)/2+1 and even=(x-n)/2..
Your query on 1 to 19 will fall under 3) and 4) above..
hope this helps..