[A] is the sum of the first 998 consecutive positive integers, so it has 998 terms in it.
Gauss's method involved doubling the sum while grouping terms in a clever way: let S be the sum, so that
S = 1 + 2 + 3 + ... + 996 + 997 + 998
It's also true that
S = 998 + 997 + 996 + ... + 3 + 2 + 1
so that adding these equations together gives
2S = (1 + 998) + (2 + 997) + ... + (997 + 2) + (998 + 1)
2S = 999 + 999 + ... + 999 + 999
We know there are 998 terms on the right side, so
2S = 998 * 999 = 997,002
S = 997,002/2 = 498,501
[B] You can do this one the same way. The hardest part is counting how many terms there are in the sum.
Starting with 1, the n-th positive odd integer is given by 2n - 1. The last term in this sum is 101, so
2n - 1 = 101
2n = 102
n = 102/2 = 51
and the sum contains 51 terms.
Let S denote the sum. Then
S = 1 + 3 + 5 + ... + 97 + 99 + 101
S = 101 + 99 + 97 + ... + 5 + 3 + 1
2S = (1 + 101) + (3 + 99) + ... + (99 + 3) + (101 + 1)
2S = 102 + 102 + ... + 102 + 102
2S = 51 * 102 = 5202
S = 5202/2 = 2601