Write a program to input a number from the user and display the sum of all its digits except its first and last digit using the function void dispSum(int num). If the number has less than 3 digits then display sum of all its digits with an appropriate message.
What?
What bout the paparazzi?
Meh was very exited
┐(´(エ)`)┌
Answers
Input a number from user. Store it in some variable say num.
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.
Answer:
Write a program to input a number from the user and display the sum of all its digits except its first and last digit using the function void dispSum(int num). If the number has less than 3 digits then display sum of all its digits with an appropriate message.
Write a program to input a number from the user and display the sum of all its digits except its first and last digit using the function void dispSum(int num). If the number has less than 3 digits then display sum of all its digits with an appropriate message.
Write a program to input a number from the user and display the sum of all its digits except its first and last digit using the function void dispSum(int num). If the number has less than 3 digits then display sum of all its digits with an appropriate message.
Explanation:
you switched to which of your account Domb.. <(-︿-)>