LearnFrenzy
Sign in Take a free test

Operators and Expressions · Exercise 4 of 4

Operators and Expressions Operator Programs

  • 8 questions
  • Page 1 of 1
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Programs built mainly from arithmetic, relational and conditional operators. Write each one yourself first, then open the solution – every solution was compiled and run, and the output shown is the real output.

Question 1 Easy

For each number, print whether it is even or odd and positive, negative or zero, using only operators (no if).

Question page & discussion
Question 2 Easy

Compute simple and compound interest for a principal of 50000 at 8% for 3 years.

Question page & discussion
Question 3 Easy

Convert 1000 days into years, weeks and remaining days (ignoring leap years).

Question page & discussion
Question 4 Medium

Find the largest of three numbers with a single conditional-operator expression.

Question page & discussion
Question 5 Easy

Compute the area and perimeter of a 7 × 3 rectangle and the area and circumference of a circle of radius 2.

Question page & discussion
Question 6 Medium

Find the time on a 24-hour clock 1000 minutes after 22:30, and 45 minutes before 00:10.

Question page & discussion
Question 7 Easy

Compute the body mass index (weight / height²) and its category for a weight of 68 kg and a height of 1.72 m.

Question page & discussion
Question 8 Easy

Reverse any three-digit number using only / and %.

Question page & discussion
All exercises doneBack to Operators and ExpressionsRevise the concepts or pick another topic

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links