1. Declare an double array with max 100 elements
2. Input an positive integer n that indicated the number of element of array
3. Input n elements of array
4. Display array has just been inputted
5. Calculate sum of all elements, sum of odd element, average of even elements, average of element at odd index
file C;array
6. Propose my array sample
Check input value divisible 5.
file C:example
II. Reflection
I know use array , i know forming of array. I think array is very important and convenient. Because we do not declared the variable a lot of if repeat. We will have less mistake when we code . And program will easy check and short code.
We have two way to declare the variable.For example
int[10];
int[3][3];
Note:
- index may be í the real number , when it will take the integer part of the real number as the array index.
- When the index beyond the array size, the machine is not an error, but will produce a random value, then the computer will access to an external memory arrays and can disrupt the program.
No comments:
Post a Comment