The last digit#5175

The last digit (Editorial)

The last digit of a positive integer is .

Algorithm implementation

Read the input value of .

scanf("%d",&n);

Compute and print the last digit of the number .

printf("%d\n",n % 10);

Java implementation

import java.util.*;

public class Main
{
  public static void main(String[] args)
  {
    Scanner con = new Scanner(System.in); 
    int n = con.nextInt();
    int res = n % 10;
    System.out.print(res);
    con.close();
  }
}

Python implementation

Read the input value of .

n = int(input())

Compute and print the last digit of the number .

a = n % 10
print(a)