logo CodeStepByStep logo

three_consecutive

Language/Type: C parameters if/else logic return

Write a function named three_consecutive that accepts three integers as parameters and returns 1 if they are three consecutive numbers, and 0 if they are not. Consecutive numbers are ones can be arranged into an order such that their values differ by exactly 1. For example, the call of three_consecutive(3, 2, 4) would return 1.

Function: Write a C function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.