In C++ the braces of and if <\/em>or an else <\/em>clause can contain another if <\/em>statement. There are known as nested if <\/em>statements.<\/p>\n In simple terms a nested if <\/em>is when you write an IF inside another IF braces.<\/p>\n This is the basic structure of a nested if.<\/em><\/p>\n <\/p>\n And of course we can nest else if <\/em>in the similar way as you nest the if statement.<\/em><\/p>\n This is an example of a program with nested if-else.<\/em><\/p>\n <\/p>\n <\/p>\n And this will be the output:<\/p>\n <\/p>\n <\/p>\n -The Admin.<\/p>\n <\/a> <\/p>\n","protected":false},"excerpt":{"rendered":" In C++ the braces of and if or an else clause can contain another if statement. There are known as nested if statements. In simple terms a nested if is when you write an IF inside another IF braces. This… Continue Reading →<\/a><\/p>\n","protected":false},"author":259,"featured_media":28482,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[582,206,62,908,618,152,617,615],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28483"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/259"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=28483"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28483\/revisions"}],"predecessor-version":[{"id":28486,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28483\/revisions\/28486"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media\/28482"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=28483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=28483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=28483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}if<\/span>( boolean_expression 1<\/span>)\n{\n \/\/ Executes when the boolean expression 1 is true<\/span>\n if<\/span>(boolean_expression 2<\/span>)\n {\n \/\/ Executes when the boolean expression 2 is true<\/span>\n }\n}\n<\/pre>\n<\/div>\n
#include <iostream><\/span>\nusing<\/span> namespace<\/span> std;\n \nint<\/span> main<\/span> ()\n{\n int<\/span> marks =<\/span> 55<\/span>;\n if<\/span>( marks >=<\/span> 80<\/span>) {\n cout <<<\/span> \"U are 1st class !!\"<\/span>;\n } \n else<\/span> {\n if<\/span>( marks >=<\/span> 60<\/span>) {\n cout <<<\/span> \"U are 2nd class !!\"<\/span>;\n } \n else<\/span> {\n\tif<\/span>( marks >=<\/span> 40<\/span>) {\n \t cout <<<\/span> \"U are 3rd class !!\"<\/span>;\n\t}\n\telse<\/span> { \n\t cout <<<\/span> \"U are fail !!\"<\/span>;\n }\t\t \n }\n }\n return<\/span> 0<\/span>;\n}\n<\/pre>\n<\/div>\n
U are 3<\/span>rd class<\/span> !!<\/span>\n<\/pre>\n<\/div>\n