BTEC Record of Practical Activity Template
BTEC Record of Practical Activity Template
Learner name:
Doan Quang Tu
Qualification:
BTEC Level 5 HND Diploma in Computing
Unit or Component
number & title: Programming
Name of *Observer/
*Witness: Nguyen Thi Hong Hanh
*please delete as applicable
20/2/2024
Date of Activity:
In programming, an array is a data structure used to store a set of values of the same data type,
arranged in a certain order. Here's how to use arrays, calculate array length, and iterate through
array elements using loops in C#:
1. **Array**: To declare an array in C#, you can use the following syntax:
```csharp
// Declare an array of type int with 5 elements
int[] numbers = new int[5];
```
2. **Array Length**: The length of an array is the number of elements in that array. To get the length
of an array in C#, you can use the `Length` property:
```csharp
int[] numbers = { 1, 2, 3, 4, 5 };
int length = numbers.Length; // The length of the array is 5
```
3. **Loop Through an Array**: To iterate through the elements of an array in C#, you can use loops
like `for`, `foreach`, or `while`:
- Use `for` loop:
```csharp
int[] numbers = { 1, 2, 3, 4, 5 };
for (int i = 0; i < numbers.Length; i++)
{
Console.WriteLine(numbers[i]);
}
Thus, the above examples help you understand how to use arrays, calculate the length of arrays and
iterate through array elements using loops in the C# programming language.
Please state the evidence this record is in support of:
*Assessor/*Witness signature:
Nguyen Thi Hong Hanh
*please delete as applicable
Electronic signatures are acceptable on all assessment and internal verification documentation if there is an audit
trail to support its authenticity. This includes a scanned signature or the individual's centre based email address. A
font style is not accepted. Please see the Centre Guide to Internal Verification for further details.