Write a C
C
program
Calculate the sum of first
and last digit of a giver
Number. For ex if number
is 1234 the result is
1+4=5
sample input
Sample output =Sum of first
and last digit of 5678 is
=
5678
( 3
Answers
Answered by
0
Answer:
To find last digit of given number we modulo divide the given number by 10 . Which is lastDigit = num % 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
give me thank
Similar questions