Untitled

mail@pastecode.io avatar
unknown
c_cpp
6 months ago
277 B
1
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
	int a, b, c = 0, sum = 0;
	cin >> a >> b;
	if (a < 0)
	{
	    while (c != a)
	    {
	        sum -= b;
		    c--;
	    }
	}
	else
	{
		while (c != a)
		{
			sum += b;
			c++;
		}
	}
	cout << sum;
}
Leave a Comment