int main()
{
int a=0, c, d, N, K;
bool stopBool = 0;
cin >> N >> K;
c = N;
while (1)
{
if (N-c ==K)
{
a++;
}
c--;
if (c == -1)
{
N--;
c = N;
}
if (N == -1)
{
break;
}
}
cout << a;
}
This is supposed to find take a number N and K and find all numbers between 0 and N that equal K and cout the number of pairs that fit it but it doesn't work.
find all numbers between 0 and N that equal K and cout the number of pairs that fit it but it doesn't work.
Number between 0 and N that equals K is K itself by the way.
Why don't you try to describe your problem more accurately and not explain what you mean by "doesn't work" - you could not compile it at all or it gives wrong answer or what?