Display the square of a number

  • 2
  • Locked
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 (50)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Thomas
Level 7 , Scottsdale, United States
16 September, 00:50
see Jack approach below -- look carefully
4 August, 09:06
ah crap, forgot to leave spaces between factors, useful exercise.
Grace
Level 1 , Jessheim, Norway
9 March, 23:11
oh, i thought the output would be 25.. i got it anyway at two attempts
Brendon Martell
Level 3 , Providence, United States
25 March 2020, 22:23
I got the same output result a different way...
Edip Uslu
Level 2 , Kuala Lumpur, Malaysia
22 February 2020, 10:27
what if i use *25 rather then number again ?Isnt it another approach to the answer whith the same result
Sean Nigito
Level 6 , Newark, United States
13 July 2020, 18:34
yes but it does not work for all the possible inputs
Robert Tonkavich
Level 1 , Port Huron, United States
21 February 2020, 23:36
My Bad I did not see that the class had already declared the variable number.
Robert Tonkavich
Level 1 , Port Huron, United States
21 February 2020, 23:35
Did not see where it introduced using public static int declaration
Timothy Strong
Level 4 , San Diego, United States
6 October 2019, 02:37
Forgot printing integers does not require quotation marks.
19 August 2019, 08:47
nice
Sam Idris
Level 1 , Kumasi , Ghana
9 July 2019, 10:42
wow