can any tell me what wrongs with my piece of code, I mean the given test cases it passes but while submitting it shows wrong answer.
#include
using namespace std;
int sum_of_1_and_last_digit(long long int X)
{
int sum=0,last=0,number=X;
//storing the last digit
last = number%10;
// while loop for calculating the first digit
while(X>0)
{
X=X/10;
if (X/10 == 0)
break;
Your given approach is helpful but could you please point me where my logic stuck and below is the output snippet for you reference where it is shown that for single-digit is also giving the right output