write a program in java to input any integer number with odd length and display the square of the middle digit
Answers
Answered by
0
Answer:
Here's your answer !
Explanation:
import java.util.*;
class Program {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number with odd number of digits : ");
String num = sc.next();
System.out.println("Middle number : " + num.charAt(num.length() / 2));
}
}
Similar questions