0

Dear Sir,

Could you tell me how can I do the following question?

A positive integer is entered from the keyboard. If it's even, all even integers from 2 up to and including the entered integer are displayed. If odd, all odd integers from 1 up to and including the entered integer are summed, and the sum displayed.

For example if the number entered was 20, the display would be:

2 4 6 8 10 12 14 16 18 20

Alternatively, if the number entered was11, the display should be:

36

Cheers,