undefined

Tasks about loops

Java Syntax
Level 4 , Lesson 10
Available

"Hi, Amigo!"

"I heard that you've learned about loops. I'll give you a couple of tasks."

undefined
2
Task
Java Syntax, level 4, lesson 10
Locked
1 to 10
Human kids quickly learn to count to ten with their fingers. The inhabitants of Planet Skrewy with their 2,048 tentacles are less lucky. Let's count up to ten using Java and a while loop. We won't just count. We'll also display our count, and each value must be displayed on a new line.
undefined
2
Task
Java Syntax, level 4, lesson 10
Locked
From 10 to 1
"Loops are the best thing that happened to me in the last level". We found this statement in one CodeGym student's training log. Her student profile indicated she was on the fourth level. Do you agree with her? Either way, now we'll display numbers from 10 to 1. And we'll do this using a while loop. Are you up for it?
undefined
2
Task
Java Syntax, level 4, lesson 10
Locked
You can't have too much of a good thing
"Look how beautiful the world is without loops!" The guy who said this is busy displaying the table of squares of all numbers that can be represented by the int data type. He's been working on it for the past 5 years. I propose that we disagree with him and create a program with loops: specify a string and number N, and then display the string N times.
undefined
4
Task
Java Syntax, level 4, lesson 10
Locked
Seeing dollars in your future
If you open this task at midnight, take a while loop, and display a 10x10 square of dollar signs, then you'll learn to use a while loop to display a 10x10 square of dollar signs. You shouldn't expect untold riches to immediately follow. But if you keep completing these tasks, they almost certainly will.
undefined
4
Task
Java Syntax, level 4, lesson 10
Locked
Multiplication table
In ancient times, when robots were few, human children were forced to learn the multiplication table. How cruel! Multiplication tables were written by hand over and over in notebooks. What a waste! We won't sully any paper, and there's no reason to teach you the table. Simply display it on the screen. Here's your secret weapon: the while loop.
Comments (33)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
KARMA GURUNG Level  5, Wyken, United Kingdom
17 February 2021
hint : nested for loop just like previous $ solution.
Sekh Parvez Level  7, New York City, United States
23 October 2020
Nested While loop works. The only thing is had to reset my 2nd variable after it ended. for loop is a lot easier as it resets every time for you.
Chandan Thapa Level  22, Dubai, United Arab Emirates
4 October 2020
I think I remember I also did this multiplication table in one of the previous lessons. But this improves our knowledge;
Joffrey Wallaart Level  9, Eindhoven, Netherlands
18 August 2020
All these tasks would be much better off with a for loop... You should never use a while loop if you know upfront how many times you want the loop to execute.
Maryem Vickers Level  7, HT..., United Kingdom
29 July 2020
*terrible flashbacks of having to do multiplication tables when I was smaller* Yikes. You're right diego that was so cruel.
Oliver Heintz Level  17, Mustang, United States
2 June 2020
Multiplication table hint: I copied and pasted the code for "Seeing dollars in your future" and changed just a few things. Took me less than a minute.
Brandon Leirer Level  7, Keller, United States
30 May 2020
2 while loops did the trick. That wasn't too bad.
hidden #10568956 Level  9
7 January 2020
Tips if you go this way and multiplicate with 1 to 10.... just use the last System.out withprintLN

System.out.print(i * 2 + " ");
matt Level  11, Springfield, United States
2 January 2020
that multiplication table is brutal
Kemal Level  7, Mumbai, India
13 September 2019
how to read from keyboard. string and number please tell syntax