+ 1
Read a number and print your square in java language
help me...this is homework.
2 Answers
+ 12
System.out.print(num*num);
+ 2
I'll assume you mean the square of the input:
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
System.out.println(Math.pow(i, 2));
}
}