SHARE
TWEET

FromOneToN

a guest Nov 15th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var
  2.   a: int64;
  3.  
  4. begin
  5.   readln(a);
  6.   if(a > 0) then
  7.     if a mod 2 = 0 then
  8.       writeln((a + 1) * (a / 2))
  9.     else
  10.       writeln((a + 1) / 2 * a)
  11.   else
  12.     if a mod 2 = 0 then
  13.       writeln((a + 1) * ((2 - a) / 2))
  14.     else
  15.       writeln((a + 1) / 2 * (2 - a));
  16. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top