Write a method called firstDigit that returns the first (most significant) digit of an integer. For example,

Question:

Write a method called firstDigit that returns the first (most significant) digit of an integer. For example, firstDigit(3572) should return 3. It should work for negative numbers as well;

firstDigit(-947) should return 9.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: