Resolution of the proposed exercises: REPETITION STRUCTURES AND ARRAYS IN JAVA LANGUAGE . This course I had the honor of co-creating with the online course platform DIGITAL INNOVATION ONE ?? and made available free of charge to the Java developer community.
By watching this course, Dev will be able to understand in practice how to work with repetition structures (while/do-while/for) and arrays. When it comes to arrays, we will also learn about the foreach structure.
? Overview: Repetition Structures and Arrays
➿ Loops Exercises
⛓ Arrays Exercises
? The real power of computers lies in their ability to repeat an operation or series of operations multiple times ( loop ).
? A repetition structure allows a sequence of commands to be executed repeatedly if certain conditions are met.
? These conditions are represented by logical expressions.
? Repetition structures can be classified into:
?The break command is used to abruptly end a repetition.
?When the continue command is executed, the remaining repetition commands are ignored and the program returns to testing the condition again.
ARBITRARY EXECUTION FLOW: goto
?The goto command is intended to divert program execution to any other point in the program, disregarding any repetition structure or conditional structure.
?Unlike C/C++, Java does not have a goto statement, but java supports label .
? https://www.geeksforgeeks.org/g-fact-64/
? https://www.tutorialspoint.com/How-to-use-labels-in-Java-code
?Name and Age: Make a program that reads sets of two values, the first representing the student's name and the second representing their age. (Stop the program by entering the value 0 in the name field)
?Note: Write a program that asks for a note, between zero and ten. Show a message if the value is invalid and continue asking until the user enters a valid value.
?Largest and Average: Write a program that reads 5 numbers and reports the largest number and the average of these numbers.
?Even and Odd: Make a program that asks for N integers. Calculate and show the number of even numbers and the number of odd numbers.
?Tables: Develop a multiplication table generator, capable of generating the multiplication table for any integer between 1 and 10. The user must inform which number he wants to see the multiplication table for. The output should be as shown in the example below:
5 times table:
5X1 = 5
5X2 = 10
...
5 X 10 = 50
?Factorial: Write a program that calculates the factorial of an integer provided by the user.
Ex: 5!=5.4.3.2.1=120
? List of Exercises Repetition Structures - Possible Solutions
? Array is an object used to sequentially store data of the same type.
? They remain the same size after they are created.
?Reverse Order: Make a Program that reads a vector of 5 integers and displays them in reverse order.
?Consonants: Write a Program that reads a vector of 6 characters, and tells you how many consonants were read. Print the consonants.
?Random Numbers: Make a Program that reads 20 random integers (between 0 and 100) and stores them in a vector. At the end, show the numbers and their successors.
? List of Exercises One-Dimensional Arrays - Possible solutions
?Multidimensional Array: Generate and print a 4x4 M matrix with random values between 0-9. After that, determine the smallest number in the matrix and its position (row, column).
? List of Exercises Multidimensional Arrays
? https://www.ic.unicamp.br/~wainer/cursos/2s2011/Cap06-RepeticaoControle-texto.pdf
? http://www2.ic.uff.br/~vanessa/material/prog1/Aula6.pdf
? http://www.facom.ufu.br/~backes/gsi002/Aula05-ComandosRepeticao.pdf
? https://blog.grancursosonline.com.br/java-operadores-de-incremento-e-decremento/
? http://www.facom.ufu.br/~bacala/POO/04%20-%20Arrays%20em%20Java.pdf
? http://www.inf.ufsc.br/~frank.siqueira/INE5404/7.Arrays.pdf
This repository was created for study purposes, so please contribute to it.
If I helped you in any way, I'll be happy to know. And if you know someone who identifies with the content, be sure to share.
If possible:
️ Star the project
? Find and report issues
Available with ♥ by camila.