one more help I am Biginner pls bear with me, I am struggling to understand how this arrive at 13 as an answer when u subtitute 2 for a and count will be zero if Im following well then it will return a value of 3 then do I use the 3 again which count will be1 this time
#include <iostream>
using namespace std;
int result(int valueP)
{
int count = 0;
int a = 2;
while (count < valueP)
{
a += count + a / 2;
count += 2;
}
return a;
}
int main ()
{
cout << result(6) << '\n';
return 0;
}
cout<<a<<endl;
u can use this code to show the ans, truncation when u do(a/2=1) and start from count=zero so it will do three times,count=count+2, so count=0,count=2,count=4