In: Computer Science
Write a statement to output on the console the value of the last element in a single-dimensional array of integers called grades.
To get last element of an array we must find length of an array.
last element of an array is at (length of an array - 1) index.
we have several programming languages. I will write this statement in some languages.
In C language:
In C++ language:
In java we have length function which returns length of an array:
In python we have len() function which returns length of an array: