Program users are (supposedly) normal people -- they don't read instructions all of the time and they frequently make mistakes. Programmers need to take this into account.
Even a naive mathematician realizes that a triangle should not have any dimensions that are negative or equal to zero. The program below checks to see if the data being entered is reasonable. Note that the actions taken by the program are different. If the value given by the user for the base is not acceptable, the program makes a comment and stops -- if it is OK, it just continues on, asking for the height. Again, the program terminates if the data provided is inappropriate, but otherwise it says that the value is OK.
Note that for each if statement, the then statement is a compound statement (more than a single statement), while the else statement for the second if is only a single statement. In other words, if the condition is TRUE in either instance, two things are to be done, but if the second condition is FALSE, only one thing (the printing of the message) will occur.
% Interactive program which comments on input var b: int %base var h: int %height var A: real %Area %-------------------Introduction------------------ put "This program calculates and prints the area of a triangle" put "after you enter its dimensions." put "When asked to, type in a dimension and hit the ENTER key." %--------------Inputting & Checking Data------------- put "What is the length of the triangle's base? ".. get b if b <= 0 then put "This would be one weird triangle!" quit end if put "What is the triangle's height? ".. get h if h <= 0 then put "The height should be positive." quit else put "That seems reasonable for the height." end if %-------------------Calculation------------------ A := b * h / 2 %-------------------Printing Results------------------} put "" put "The area of a triangle with a base of ", b, " units and" put "a height of ", h, " units is ", A:0:1, " square units."