Input a number and find the sum of first and last digits of the number. in computer
Answers
Answered by
0
Answer:
Logic to find sum of first and last digit using loop
Input a number from user. ...
To find last digit of given number we modulo divide the given number by 10 . ...
To find first digit we divide the given number by 10 till num is greater than 0 .
Finally calculate sum of first and last digit i.e. sum = firstDigit + lastDigit .
Similar questions