Display the square of a number

  • 2
First impressions are rarely the best, but they are certainly what we remember for the rest of our lives. We're talking about programming, in case you were wondering. In this task, we will try to calculate the square of a number, display it on the screen, and also use the ability to read data from the keyboard (the user will enter the number while the program is running).
You can't complete this task, because you're not signed in.
Comments(45)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Brendon MartellLevel 3 , Providence
25 March, 22:23
I got the same output result a different way...
Edip UsluLevel 2 , Kuala Lumpur
22 February, 10:27
what if i use *25 rather then number again ?Isnt it another approach to the answer whith the same result
Robert Tonkavich Level 1 , Port Huron
21 February, 23:36
My Bad I did not see that the class had already declared the variable number.
Robert Tonkavich Level 1 , Port Huron
21 February, 23:35
Did not see where it introduced using public static int declaration
Timothy StrongLevel 4 , San Diego
6 October 2019, 02:37
Forgot printing integers does not require quotation marks.
19 August 2019, 08:47
nice
Sam Idris Level 1 , Kumasi
9 July 2019, 10:42
wow
Pranjal sharmaLevel 2 , Gurgaon
6 July 2019, 08:08
public static void main(String[] args) int number=2; system.out.println(number*number); whats wrong in this??
PhuongLevel 3 , Melbourne
6 July 2019, 19:20
system needs to be System (capital S)
Colin McKayLevel 2 , Buffalo
13 August 2019, 13:03
it says don't change the variable int number = 25;
Edip UsluLevel 2 , Kuala Lumpur
22 February, 10:29
The mistake is that you forgot { after args) Your code should be the same with the addition of public static void main(String[] args) {
ousi4ousLevel 2 , Douala
6 April 2019, 20:07
I have difficulties in getting this one done
AibohphobiaLevel 1 , Fort Campbell
25 March 2019, 02:14
Something jumped over subject matter; this lesson is covering material that was never discussed as of yet?
PhuongLevel 3 , Melbourne
6 July 2019, 19:22
Not really, its still all variables and output, and how to concatenate (chain/link) them together
JackLevel 3 , Yerevan
8 April, 15:56
the (int) variable is already declared int line 9 (int number = 25) in the hints it says do number * number => number = 25 => System.out.println() you do the maths :)