//cout << "Enter a Number:";
cin >> number;
first = number % 10;
while(number != 0)
{
last = number % 10;
number = number / 10;
}
sum = first + last;
//cout << "Sum of First and Last Digit of Given Number is : " << sum;
cout << sum;
return 0;
Just because of you printed “Enter a Number:” and "Sum of First and Last Digit of Given Number is :"
You just need to print expected output nothing else