Whats in this post?
- Background and Explanation of the code
- Download Code
To copy code: Click “View Source” on the right of this code snippet.
Background and Explanation of the code
1.In the above program , the user is prompted to enter the values of three numbers a, b, c.
2.It first checks the test condition (a>b). If this condition is true then it checks for a test condition (a>c) using if-else block contained in it.
3. If the condition (a>c) is true then message A is greatest is displyed otherwise message C is greatest is displayed .
4. But if the condition (a>b) is false then it checks for test condition (b>c) using another if-else statement contained in within else block.
5.If the condition (b>c) is true then message B is greatest is displayed otherwise message C is greatest is displayed.
On execution of the program the output is shown:
Enter three numbers(A,B,C)
C= 5 is greatest