## Java Program to print the last digit of given number N

### Description

```Get an number  n from user  and display the last digit of n
Input 1:
623
Output1:
3
Input2:
280
Output2:
0
```

### Solution

```import java.util.*;
class LastD
{
public static void main(String args[])
{
int input1,digit;
Scanner sc=new Scanner(System.in);
System.out.println("Enter The Input:");
input1=sc.nextInt();
digit=input1%10;
System.out.println("The Last Digit is:"+digit);
}

}
```

### Explanation

```Get a input input1 (using scanner class)

Seprate the last digit of number num by "digit = input%10". (% by 10 always gives last digit of a number)

print the digit (using system.out.println)```

#### Author - Ramesh P Natarajan

Learner, Professor, Technology Trainer, Software Developer and Content Marketer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

### Interesting Pattern Programs: for more Patterns

```Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution```
```Input:
5
Output:
*
***
*****
*******
*********
*******
*****
***
*Solution```
```Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution```
```Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution```
```Input:
5
Output:
*********
*******
*****
***
*
***
*****
*******
*********Solution```