SHARE
TWEET

Untitled

a guest Dec 8th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5.     int n,s=0;
  6.     cin>>n;
  7.     if (n>0 )
  8.     {
  9.     for (int i=0;i<=n;i++)
  10.         s=s+i;
  11.    
  12.         cout<<s<<endl;}
  13.     else
  14.         if (n<=0)
  15.     {    for (int i=n;i<=1;i++)
  16.             s=s+i;
  17.     cout<<s<<endl;
  18.     }
  19.     return 0;
  20. }
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