-
These exercises are a series done in JAVA, using IntelliJ IDEA.
-
To run each one, in src/Main.java -> scroll down to line 539, and input intended exercise number.
-
In src/AlgorithmExercisesSheet <-- List of exercises.
EXERCISES – GROUP I - Reading/Writing ; Variables
- Create an algorithm that reads a person's name and writes "Hello" followed by the person's name.
- Create an algorithm that, after reading two integers, displays their sum.
- Create an algorithm that after reading two integers displays their difference.
- Reading the base and height of a triangle is intended to calculate its area.
- Make a program that receives a value that is the amount paid, a second value that is the price of the product and returns the change to be given.
- Make a program that receives the value of a kilo of a product and the amount of kilos of the product consumed calculating the final amount to be paid.
- The price of a car is calculated by adding the factory price to the tax price (45% of the price ex-factory price) and dealer percentage (28% of ex-factory price). Write an algorithm that reads the name of the car and factory price, and write the car name and final price.
EXERCISES – GROUP II - Conditions
- Write a program that receives 2 values and returns the largest one.
- Write a program that receives 4 values and returns the smallest one.
- Write a program that checks if a number is odd.
- Write a program that receives 3 values that will represent the sides of a triangle and check if the values form a triangle and classify this triangle.
- Use the IF structure to make a program that returns the name of a product from its code.
- Redo the previous exercise using the structure IF-CASE === switch.case
EXERCISES – GROUP III - CYCLES
- Write a program that uses the WHILE structure to read 50 numbers and calculate and display the arithmetic mean from them.
- Redo the exercise using the FOR framework.
- Given a series of N integer values, create an algorithm that calculates and writes the arithmetic mean of these values.
- Adapt the previous exercise considering that if the average obtained is greater than 8, 10 must be assigned to the average.
- Given a set of n integers entered by the user, make an algorithm that calculates the average of the values greater than 4.
EXERCISES – GROUP IV
- Create a program that lets you convert a value in hours to seconds and displays the value in seconds.
- Create a program that lets you convert a value in days to years, weeks, and days.
- Create a program that lets you convert a value in bytes to bits.
- Create a program to convert a value in Megabytes to Bytes.
- Create a program to multiply two numbers without using the multiplication operator.
- Read N numbers, determine the largest, smallest and average of the N numbers read.
- Create a function that, given a year, checks whether or not it is a leap year.
- Write a program that converts a binary value to decimal.