@@ -0,0 +1,1004 @@
+package java_problems.beginner;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0A/*%0D%0A * If Give an integer N . Write a program to obtain the sum of the first and%0D%0A * last digit of this number.%0D%0A * %0D%0A * Input: %0D%0A * The first line contains an integer T, total number of test cases. Then follow%0D%0A * T lines, each line contains an integer N.%0D%0A * %0D%0A * Output: %0D%0A * Display the sum of first and last digit of N.%0D%0A * %0D%0A * Constraints: %0D%0A * 1 %3C= T %3C= 1000%0D%0A * 1 %3C= N %3C= 1000000%0D%0A * %0D%0A * Example %0D%0A * Input:%0D%0A * 3%0D%0A * 1234%0D%0A * 124894%0D%0A * 242323%0D%0A * %0D%0A * Output:%0D%0A * 5%0D%0A * 5%0D%0A * 5%0D%0A */%0D%0Apublic class FirstAndLastDigit %7B%0D%0A%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09%0D%0A%09%09Scanner sc = new Scanner(System.in);%0D%0A%09%09int numCases = Integer.parseInt(sc.nextLine());%0D%0A%09%09for (int i = 0; i %3C numCases; i++) %7B%0D%0A%09%09%09String number = sc.nextLine();%0D%0A%09%09%09int sum = 0;%0D%0A%09%09%09sum += (Integer.parseInt(number.charAt(0) + %22%22)%0D%0A%09%09%09%09%09%09%09+ (Integer.parseInt(number.charAt(number.length() - 1) + %22%22)));%0D%0A%09%09%09System.out.println(sum);%0D%0A%09%09%7D%0D%0A%09%09sc.close();%0D%0A%09%7D%0D%0A%7D

Add FirstAndLastDigit