Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
238 B
0
Indexable
Never
#include <iostream>
using namespace std;
int main() {
	int l, i, b, с, d, f = 0;
	cin>> l;
	if (l > 0 && l != 0)
	{
		for (i = 1; i <= l; i++)

			f += i;
	}
	else
	{
		for (i = 1; i >= l; i--)
			f += i;
	}
	cout<< f;
}