Next: Nested if and if-else
Up: The if-else Statement
Previous: Review Questions
In each of these exercises produce an algorithmic description before proceeding to write the program.
x
and y
are
input will output the absolute difference of the two integers. That is
whichever one of (x-y)
or (y-x)
is positive.
Think of all the cases that can arise and consequently
plan a set of test data to confirm the correctness of your program.t
or s
).A student passes if all three examinations are passed. Additionally a student may pass if only one subject is failed and the overall average is greater than or equal to 50. The pass mark for an individual subject is 40.
Write a C++ program to implement this task.