write a program In java to input an integer and print the sum of first and last digit
Answers
Answered by
0
Answer:
fjiwijfrbjdfinhof snxjgjogifo
Answered by
1
Answer:
public class Main
{
public static void main(String args[])
{
int number = 502356997;
int firstDigit = 0;
int lastDigit = 0;
lastDigit = number%10;
System.out.println("Last digit: "+lastDigit);
while(number!=0) {
firstDigit = number%10;
number /= 10;
}
System.out.println("First digit: "+firstDigit);
}
}
Last digit: 7
Last digit: 7First digit: 5
Similar questions
English,
2 days ago
Math,
2 days ago
Math,
4 days ago
Accountancy,
8 months ago
English,
8 months ago