Hindi, asked by rinareenasharma123, 1 month ago

enter 10 numbers and find average with last digit 2 and 4​

Answers

Answered by anjali198344
2

Answer:

Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output ... To find last digit of a number, we use modulo operator %. ... then last Digit = n % 10 => 4


rinareenasharma123: can you give me the full program
anjali198344: please give me 10 minutes
anjali198344: Find first and last digits of a number

Given a number and to find first and last digit of a number.

Examples:

Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 2
rinareenasharma123: thanks but not helpful to me
anjali198344: ok I will try
anjali198344: Find first and last digits of a number

Given a number and to find first and last digit of a number.

Examples:

Input : 12345 Output : First digit: 1 last digit : 5 Input : 98562 Output : First digit: 9 last digit : 2
anjali198344: Recommended: Please solve it on PRACTICE first, before moving on to the solution.

To find last digit of a number, we use modulo operator %. When modulo divided by 10 returns its last digit.
Suppose if n = 1234
then last Digit = n % 10 => 4
To finding first digit of a number is little expensive than last digit. To find first digit of a number we divide the given number by 10 until number is greater than 10. At the end we are left with the first digit.

Approach 1 (With loop):
anjali198344: sorry mai Answer nahi de pai
rinareenasharma123: koi nai but thanks
anjali198344: ok bye
Similar questions