Respuesta :
Answer:
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader brObject = new BufferedReader(new InputStreamReader(System.in));
String str;
while ((str = brObject.readLine()) != null) {
int number = Integer.parseInt(str);
System.out.println(number * number);
}
}
}
Explanation:
- Inside the main method, create an object of BufferedReader class to read lines from standard input.
- Declare a string and run a while loop until it reaches the end of the input.
- Inside the while loop convert the string into an integer data type.
- Finally display the output by squaring the number.
The program is an illustration of loops.
Loops
Loops are used to perform repeated operations
The program
The program in Python, where comments are used to explain each line is as follows
#This gets the line of input
num = input("Number: ")
#This splits the number into list
numList = num.split()
#This iterates through the list
for i in numList:
#This prints the square of each number
print(int(i)**2)
Read more about loops at:
https://brainly.com/question/19344465