C++ if-elseIn C++ programming, if statement is used to test the condition. There are various types of if statements in C++.
C++ IF StatementThe C++ if statement tests the condition. It is executed if condition is true. ![]() C++ If ExampleOutput:/p> It is even number C++ IF-else StatementThe C++ if-else statement also tests the condition. It executes if block if condition is true otherwise else block is executed. ![]() C++ If-else ExampleOutput: It is odd number C++ If-else Example: with input from userOutput: Enter a number:11 It is odd number Output: Enter a number:12 It is even number C++ IF-else-if ladder StatementThe C++ if-else-if ladder statement executes one condition from multiple statements. ![]() C++ If else-if ExampleOutput: Enter a number to check grade:66 C Grade Output: Enter a number to check grade:-2 wrong number
Next TopicC++ switch
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week