C++ Exercises: Accept two integers and return true if either one is 5 or their sum or difference is 5
Check if 5, Sum 5, or Difference 5
Write a C++ program that accepts two integers and returns true if either one is 5 or their sum or difference is 5.
Sample Solution:
C++ Code :
Sample Output:
1 0 1
Visual Presentation:

Flowchart:

For more Practice: Solve these Related Problems:
- Write a C++ program that accepts two integers and returns true if either one is 5 or if their sum or absolute difference equals 5.
- Write a C++ program that reads two numbers and checks for the presence of the value 5, or if their sum/difference equals 5, outputting a boolean result.
- Write a C++ program to determine if either input integer is 5 or if adding/subtracting them results in 5, and print true or false accordingly.
- Write a C++ program that validates two integers against the criteria: one is 5, or their sum/difference is 5, then returns a boolean outcome.
C++ Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a C++ program to compute the sum of the two given integers. If the sum is in the range 10..20 inclusive return 30.
Next: Write a C++ program to test if a given non-negative number is a multiple of 13 or it is one more than a multiple of 13.
What is the difficulty level of this exercise?