Computer Science, asked by rastogianubhuti911, 4 months ago

write a program to input a number and display its first and last digit is same or not ​

Answers

Answered by Aasiskumar205
1

Answer:

Logic to find first digit of a number

Finding first digit of any 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.

Step by step description to find first digit of a number.

Input a number from user. Store it in some variable say num.

Copy the value of num to some temporary variable say first = num.

Divide first by 10, till first >= 10.

Finally you are left with first digit in first variable.

Similar questions