Untitled
Anonymous
c_cpp
11/30/2023 4:33 PM
372 B
17
Indexable
#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;
}Editor is loading...
Leave a Comment