|
Now
we divide this TotalAge
by 10 and get the average age. We store this average age in the variable i.e.
AverageAge
by writing the statement: AverageAge = TotalAge / 10; And
at the end we display this average age on the screen by using the following
statement: cout << “ The average age of the students is : “ << AverageAge; Here
the string enclosed in the quotation marks, will be printed on the screen as
it is and the value of AverageAge
will be printed on the screen. The complete coding of the program is given below.
|
||||
|
|
Previous |
TOC |
Next |
|