SHARE
TWEET

Untitled

a guest Mar 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int i, n, sum = 0;
  6.  
  7.     scanf("%d", &n);
  8.     if(n <= 0)
  9.     {
  10.         for(i = n; i <= 1; i++)
  11.         {
  12.             sum += i;
  13.         }
  14.     }
  15.     else
  16.     {
  17.         for(i = 1; i <= n; i++)
  18.         {
  19.             sum += i;
  20.         }
  21.     }
  22.  
  23.     printf("%d\n", sum);
  24.  
  25.     return 0;
  26. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top