a: 7
b: 13
c: 10
d: Error: Array index out of bound
e: 10
f: 21
g: 22
h: 4
i: 10
j: 1
k: [7, 15, 13, 10]
l. [7, 15, 13, 10]
m. [7, 15, 13, 10, 0, 0] (Length changed to 6)
1· (1 point each) Given the array defined below, evaluate each of the expressions and write...
Write a C program convert.c that converts each number in an array by the sum of that number plus 6 modulus 10. A sample input/output: Enter the length of the array: 5 Enter the elements of the array: 3 928 4 14 77 Output: 9 4 0 0 3 The program should include the following function: void convert(int *a1, int n, int *a2) The function converts every element in array a1 of length n to an output array a2. The...
Given an array of integers as declared below, write C loop to fill it up (assign, store) with the numbers 1-100 column by column, i.e. a[0][0] = 1; a[1][0] = 2;... Use only the variables below as printed do not write them again. Just write the two loops. int a [10][10]; int value = 1; int r,c;
Write a JAVA program with methods that initializes an array with 20 random integers between 1 and 50 and then prints four lines of output, containing 1)The initialized array. 2)Every element at an even index. 3)Every even element. 4)All elements in reverse order. Requirements (and hints): 1. Build a method that takes any integer array as input and prints the elements of the array. ALL printing in this lab must be done using a call to the printArray method and...
You have an array that is defined as int array2[4] = {50, 100, 150, 200}; write a for loop and a while loop to print each element of the array with a label in the following manner using printf() with the correct format string. array2[0] = 50 array2[1] = 100 array2[2] = 150 array2[3] = 200 can it be written in C
***Please complete the code in C*** Write a program testArray.c to initialize an array by getting user's input. Then it prints out the minimum, maximum and average of this array. The framework of testArrav.c has been given like below Sample output: Enter 6 numbers: 11 12 4 90 1-1 Min:-1 Max:90 Average:19.50 #include<stdio.h> // Write the declaration of function processArray int main) I int arrI6]i int min-0,max-0 double avg=0; * Write the statements to get user's input and initialize the...
In the blank below, write the contents of array arr after the following code is executed up to the comment indicated in the main procedure below? #include <iostream> #include <algorithm> using namespace std; void do something(int list[], const int size); int main() { const int SIZE(10); int arr[SIZE] = { 5, 8, 1, 7, 3, 9, 4, 6, 10, 2 }; do somethingCarr, SIZE); ** Write the contents of array arr in the space below when execution reaches here. */...
These are questions pertaining to Java. Incorrect Question 1 0/1 pts Evaluate the below expression. Perform a step-by-step evaluation to clearly understand how a computer would evaluate the expression. You will need to solve these questions manually in the exam, without being able to evaluate these expressions using a Java program, so please learn this and indicate the answer. (40/3 +974) 30 Incorrect Question 2 0/2 pts Evaluate the below expression. Perform a step-by-step evaluation to clearly understand how a...
Write a function that takes an array of integers as an argument and returns a value based on the sums of the even and odd numbers in the array. Let X = the sum of the odd numbers in the array and let Y = the sum of the even numbers. The function should return X – Y The signature of the function is: int f(int[ ] a) Examples if input array is return {1} 1 {1, 2} -1 {1,...
1. (100 pts) Write a program that swaps the elements of an array pairwise. Start from the left of the array, take 2 elements at a time and swap the two elements. Continue in this fashion until you reach the end of the array. Declare an integer array of size 10 and place random numbers in the range [0?9]. Print the original array, pairwise swap the elements of the array and print the final array after swap. Consider the following...
Refer to the following array definition for questions 1 & 2 int numberArray[9)[11] 1. Write a statement that assigns 145 to the first column of the first row of this array. 2. Write a statement that assigns 18 to the last column of the last row of this array. values is a two-dimensional array of floats, with 10 rows and 20 columns. Write code that sums all of the elements in the array and stores the sum in the variable...