# Square of middle digit in Java

###### Input - Question 7

In this question, we will see how to input a three digit number in Java programming using the java input and find the square of its middle digit. To know more about java input click on the java input lesson.

**Q7)** Write a program in Java to input a three digit number and find the square of its middle digit.

#### Program

```
import java.util.Scanner;
public class Q7
{
public static void main(String args[])
{
int n,md;
Scanner sc=new Scanner(System.in);
System.out.println("Enter a three digit number");
n=sc.nextInt();
md=(n/10)%10;
System.out.print("Square of middle digit=" + (md*md));
}
}
```

#### Output

Enter a three digit number 562 Square of middle digit=36