There are several ways to square a number. For example, some people write a number and then draw a square around it. This method is used by people who haven't studied anywhere. Everybody else has to multiply, remember the table of squares, ... or use a program. Your program should display the square of 5.
Square of a number
You must be signed in to leave a comment
16 September 2021, 04:49
This kinda came out of nowhere ! lol --- a Method is a function in JAVA that is in a Class performing some actions. See the int a defined in the function name defined as int sqr ? that's pretty much a variable known as a - reusable - Parameter. The function is launched --or called- to do something -- above it -- and "passes in" the argument which is 5. The 5 aligns with that variable int a; and it doesn't need to be defined nor assigned separately. This is huge to understand in all programming languages. and it's fuzzy to begin with ... if this is wrong or confusing please help clarify it genius's
20 July 2021, 22:59
I don't really understand this one yet.
2 August 2021, 20:02
Me, too. I do feel the design of this task can be improved.
15 April 2021, 20:51
I would like to be able to verify multiple solutions! I found one way to do it, but would like to try other ways. Because it is already completed it wont reverify!
3 March 2021, 11:25
This was shown in previous lessons. If you read and study the presented material, you will see the pattern.
29 December 2020, 17:46
Once again I am a beginner to this and it has not been taught how to write square. This should be something taught prior to expecting us to do it.
21 January 2021, 22:22
I am with you. I am stuck with these two last ones ;(
16 September 2020, 13:10
my first try took forever to load i guess the compiler was like " what in the actual hepp"
12 May 2020, 13:02
if you read the main instructions for the course/site you will see that some lessons are marked as "future", as this one is. this means that it contains material that has not been shown yet and you will have to figure it out yourself or do a little research to get the answer. they can be skipped and only to serve as a challenge for those who want to push themselves a bit further.
10 June 2020, 02:40
To anybody out there, this advice is in need to be taken wholeheartedly, should you not want to be discouraged or feel any remorse towards codegym.
2 May 2020, 21:46
This was never taught. Isn't this a teaching program? I had no idea what to put in the println as a return value...very confusing. I was initializing a and had no idea what the return did. They explain the easy stuff ad nauseum and when it comes to this they drop the ball. When did we learn about return in a method?
16 September 2021, 04:52
Agree ! Code Gym is pretty cool and they look at all these comments to make it better ! I think they toss things out that are not covered yet as a wake up technique lol This topic will be explained in detail soon. let it ride for now !
11 April 2020, 08:03
This program should be removed or at least talked about at some point.
11 April 2020, 07:56
We never went over sqt, did we?