Flutter: Exercises & solutions part 1

Through this course, we have learned many things about Dart, like variables, types, operators, decision-making, etc. Now is the time to put what we have learned into practice with some exercises:

1. Find the average of 3 numbers

Write a program that, given three numbers, will calculate the average.


2. Positive, negative, or zero

Write a program that, given a number, will print if it is positive, negative, or zero.


3. The largest number

Write a program that, given three numbers, prints the largest one.


4. Absolute value

Write a program that, given a number, will print the absolute value.


5. Check if a number is even or odd

Write a program that, given one number, will check if it is even or odd.


6. Circle area and perimeter

Write a program that, given the diameter of the circle, will calculate the area and perimeter.


7. Weekly salary

Write a program that, given the number of worked hours, will calculate the salary of one employee.

  • Salay per hour is $10
  • Salary per extra hour $15

After 40 worked hours, we must pay the extra hourly rate.


8. The current weather

Write a program that, given a temperature in celsius degrees (°C), will tell us the type of weather following the next conditions:

  • If the temperature is equal or less than 10°C the weather is very cold
  • If the temperature is 11°C to 20°C the weather is cold
  • If the temperature is greater than 20°C and less than 30°C, the weather is normal
  • If the temperature is 30°C or more, the weather is hot
Share this article