home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_02 / 081.jpg < prev    next >
Joint Photographic Experts Group Image  |  2014-01-09  |  691KB  |  2550x3300
Labels: book | poster | reckoner
OCR: The if and if- -else Statements if input int 20 ) Note I odd( inputint printf 'Sorry that number wasn + even in" ); d; cuted; if both else printf input "That int <= number wasr positive n"; Note 2 The pro- else simple pri intf( "That number was too big. \n" program 0 return odd int odd( int intvar Note 3 return( intvar the This program consists of two functions main( and odd() The function main consists of ad .nt call followed by scanf() call. The remainder of this function combination statement. The function odd con- sists of a single turn statement. To validate the input to this program we need to check three restrictions and want give diagnostic error message for any errors Therefore, we use set of three conditions in nested if-else statements, one condition for each of the three restri ...