I can't figure out the error in my code
@coe17b030 There is nothing with your logic, although there is a slight error in your code.
You have declared x as a long long int variable, whereas, in line numbers 6,10,13 you are assigning the value of x to i, which is an int variable.
Just declare the variable i as long long int and your code will work fine.
Hope this helps.