Example
Input
25
Output
5
Required to Know
Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like System.out.print(), and Use of Data types.
Steps
Take a digit as input from the user.
Use the modulus operation to obtain the last number of the digit, and print it.
Program
import java.util.Scanner;
public class Mavenproject1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int f = n % 10;
System.out.print(f + " ");
}
}