Erle Robotics C++ GitBook

Exercises: Flow Control

Exercise 1

Write a program that checks if the angles given can make a triangle or not (their sum must be 180 degrees).

Solution

Exercise 2

Write a program that prints on the screen all the even numbers up to 10.

Solution

Exercise 3

Initialize y=0 and x=6. Then write the appropiate staments to print x is greater than y on one line and then x is equal to 6 on the next line. Do this using if statement.

Solution

Exercise 4

Write a program that tells you if a number is even or odd.

Solution