May 2012
Intermediate to advanced
679 pages
16h 56m
English
So far, we have seen programs using assignment statements and library functions. If a programming language is to have only these statements, computer would be reduced to a calculator. Computers are powerful because they (program) can take a decision. Execute selectively. For this, language needs control statements.
A simple if statement has the following format:
For example:
if ( condition ) statement ;
if (marks >=40) result = pass;
Please note that a parenthesis around the condition is mandatory. If the condition is true then the statement is executed, otherwise not. Ideally, conditions should be relational expression ...
Read now
Unlock full access