/* This is the eleventh lab of Lab EE107
The purpose of this lab fora function that multiplies every elements
in the input array by 2.
Creating the code and free of syntax and grammatical errors.
Author: Ekwegbalum Unachukwu
Star ID:do2170dt
Date: April 9th, 2024.
*/
#include <stdio.h>
// Function to multiply every element in the array by 2
void multiply_by_2_EU(int arr_EU[], int size_EU) {
for (int i = 0; i < size_EU; i++) {
arr_EU[i] *= 2;
}
}
int main() {
// Define an array
int arr_EU[] = {1, 2, 3, 4, 5};
int size_EU = sizeof(arr_EU) / sizeof(arr_EU[0]);
// Print the original array
printf("Original Array: ");
for (int i = 0; i < size_EU; i++) {
printf("%d ", arr_EU[i]);
}
printf("\n");
// Multiply every element by 2
multiply_by_2_EU(arr_EU, size_EU);
// Print the modified array
printf("Modified Array: ");
for (int i = 0; i < size_EU; i++) {
printf("%d ", arr_EU[i]);
}
printf("\n");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: