Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- long double n;
- int main()
- {
- scanf("%lf",&n);
- if(n>0) {
- printf("%.0lf\n",((1+n)/2)*n);
- }
- else {
- printf("%.0lf\n",(((1+-n)/2)*n)+1);
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement