Wednesday, November 24, 2010

Operators

Ok now we are going to learn some thing new.Very useful for your calculation parts in your program. You store the result of a calculation  in a variable by using an assign statement. An assignment statement consist of three elements, the name of the variable where you want the result stored, the assignment operator,=, which indicates that this indeed an assignment operation, and an arithmetic expression that defines the calculation you want to perform.The whole thing is terminated by semi colon that marks the end the assign statement.

            numFruit=numApples=numOranges;   // calculate the total

No comments:

Post a Comment