The output for the input '100' is supposed to be '2318' but I get '2418'.
Here is my code
8/15/2022 1:46:06 AM
But how does it change the output of 100 that much?
edit: now I understand... it's cause in the explanations, it says, every number below the number that is inputed so 100 in not included.
As index starts from 0 so for loop should work till < only
So for (int i = 0; i < 100; i++)
if you include 100 then output is 2418
Btw why not to use modulus (%)
Because of i <= tNumber
Why 101 if (i <= 100)
101 < 100 is false
99 < 100 is true
So i < 100 will stop at 99 not 101
101 <= 100 is false
100 <= 100 is true
So i <= 100 will stop at 100
use long long instead of double long
Check my code and enter 4242
What does it changes in the logic?
So 101 will be include in the loop?
Sry... my bad, I'm just lost asf
Now when the input number is 4242, the output need to be 4198308 but I get an exponential number... can you explain the error if it's not too big of a request?
It can handle more bits? Am I right?
Alright, all good for this question
I sended my last question in private chat...
(I < 100) will stop at 101
(I <= 100) will stop at 100
edit: I am I just lost?
Send us a message