5) Consider the array called myArray declared below that contains positive and negative integers. Write a loop statement to count and display the number of integers in the array that are divisible by 4. That is, your loop should display the message "Number of integers divisible by 4 is 4". int myArray[]={1,3,9,91,40,4,-5,100,20,-23}; Note: The loop should always work without modification even if the values in the array are changed.
Q: Assume that decSales is an array of 20 Decimal values. Write a statement thatresizes the array to 50…
A: Answer: ReDim statement is used to change the size of 1d or multi dimensional array which has…
Q: Consider the following two-dimensional array declaration: int [ ][] list = new int[row][ ]; a. Write…
A: a. list.length gives the length of main array.
Q: Rainfall StatisticsWrite a program that lets the user enter the total rainfall for each of 12 months…
A: The following program is in C++ language and it is compiled in the “repl.it” compiler.Program…
Q: (i) Write a definition for an array, customer that has 100 elements of Patients structures. (ii)…
A: As here no language is specified, C++ has been used to design the code.
Q: Write one or more statements that perform the tasks for an array called fractions : Declare an array…
A: Given: Write one or more statements that perform the tasks for an array called fractions : Declare…
Q: Write one or more statements that perform the tasks for an array called fractions: Declare an array…
A: Given Query: Write one or more statements that perform the tasks for an array called fractions :…
Q: PART C. Write a program, ArrayRange, that asks the user to input integers and that displays the…
A: Programming language is missing in the question. The below program is written in Java programming…
Q: Declare an array to hold eight integers. Use a for loop to add eight random integers, all in the…
A: NOTE - As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: 1-Write a program that meets the following requirements: Creates an array with 100 randomly chosen…
A: Given: Write a program that meets the following requirements: Creates an array with 100 randomly…
Q: You can assign the contents of one array to another by using O the assignment operator. the equality…
A: Array is basically used to store multiple elements of same data type. With assignment operator you…
Q: Rainfall Statistics Write a program that lets the user enter the total rainfall for each of 12…
A: Here I have created an array of strings that has all the names of months of a year. Next, I have…
Q: C++; In all different cases please create a const int SIZE_EX_1 = 10; // type of declaration. Do…
A: NOTE: - Hi, Since Mulitple questions are there, hence only the first question is solved below.…
Q: fix the error in this code. #include int insert(int *); int display(int *); int del(int *);…
A: The given problem is related to C programming where a menu-based program is shared with choice on…
Q: (Locate the largest element) Write the following function that finds the location of the largest…
A: Actually, array is a collection of elements.
Q: Given the following array declaration: int alpha[25]; Note that you DON'T know the values in the…
A: //a. use a for loop to increment the contents of even indexed elements by the value of 4 for(int…
Q: Exercise 2 1. Declare an array of string title with 4 elements. 2. Initialize the array with the…
A: #include <iostream> using namespace std; int main(){ //create array of string string…
Q: 53- Create a dynamic array of 100 integer values named myNums. Use a pointer variable (like ptr)…
A:
Q: Description Write a program that asks the user for an integer value greater than zero. It will…
A: Here I have created the function named printDown and printUp(). In the printDown() function I have…
Q: Write a program that prompts the user to read two integers and displays their sum. Your program…
A: Program: //included essential header files #include<iostream> #include<fstream>…
Q: C++ You have an array with non-repeating elements. You need the change locations between minumum and…
A: Required: C++ You have an array with non-repeating elements. You need the change locations between…
Q: Arrays Write a for loop to print all elements in courseGrades, following each element with a space…
A: Syntax: for (statement 1; statement 2; statement 3) { // code block to be executed}
Q: int ary[] = {5, 9, 4, 2, 6, 7, 8, 4}; Q A: What is the starting index of ary Q B: What is the last…
A: The detail answer is given below.
Q: Write a statement that gets the values of the elements of the array (i.e., int array[2][5];) from…
A: #include <stdio.h>int main(){ int a[2][5],min;//two dimensional array to elements //to…
Q: Assume that an array of integers named a that contains exactly five elements has been declared and…
A: Didn’t mention which language to do the problem. So, did the problem in Java.Given:Let assume an…
Q: Arrays Write three statements to print the first three elements of array runTimes. Follow each…
A: Note: As the user given index value is constant and so the value of index will not be changed while…
Q: Exercise 2 1. Declare an array of string title with 4 elements. 2. Initialize the array with the…
A: According to the guidelines, we can answer only 1st problem until and unless a particular problem is…
Q: Line 1: int values[2][4]= {{5,10,15,20},{3,6,9,1}}; Line 2: printf("%d", values[1][1)); values[2][4]…
A: Answer: True
Q: Given the following array declaration: int array[30]; Note that you DON’T know the values in the…
A: To access 4th element, you must use array[3] because array index starts from 0. Similarly for 30th…
Q: Write the pseudocode for an application that will: a. Prompt a user for three numbers. b. Store the…
A: Pseudocode for an application # creating array to store values arr=[] for i in range(3): a =…
Q: 2. Assume that the int array scores values. Write Java code fragments to do the following: a. Print…
A: Input : Given the array of numbers. Output : Print array values Shift the array and square every…
Q: Diven the following code, what should be written instead of L1 and L2 a code finds the sum of the…
A: I have run the code for the sum of first five elements in the array Program…
Q: Write a statement that assigns the value 50 to the very last element in the values array int[,]…
A: The given array declaration is: array int[,] values = new decimal[200, 100]; The name of the…
Q: Create a DWORD array named ʻz’ of size 3 using DUP operator. Leave the array ʻz’ uninitialized. You…
A: According to the information given:- we have to perform the task on the basis of instruction…
Q: nsider the following code: final int SIZE - 12; int (] myArray - nev int [SI ZE] ; int y - 1; for…
A: An array myArray of size 12 is declared whose value is declared using for loop. Here the initial…
Q: Solve this attachment
A: #include <iostream>#include <string>using namespace std; //Array and variables…
Q: 3. Insert the missing statement in the following code fragment, which is designed to initialize the…
A: c. numbers[k] = k + 1; is the missing statement in the given code fragment, which will initialize…
Q: (Locate the largest element) Write the following function that finds the location of the largest…
A: Declare a double and integer type array. Use nested for loop to read elements from user and store it…
Q: The should output that the time is 4 and 19. Write a that manages a list of up to 10 scores should…
A: Answer: I have done code and also I have attached code as well as code screenshot and output.
Q: 3.) Write code that creates an array named odds, and stores all odd numbers between -8 and 18, using…
A: This java program creates an array named odds. Its index value will be depending on another variable…
Q: *12.2 (Array IndexOutofBoundsException) Using the two arrays shown below, write a program that…
A: Please find the answer below :
Q: Correct the following wrong statements. The following statement creates and initializes the…
A: Array: It is a collection of similar type of data. The syntax for creating and initializing 2 d…
Q: Part 1 The range of a set of values is the difference between the highest value and the lowest value…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the main function.…
Q: 19. Write a pr in the computer's memory. should store the player's name and the other array should…
A: The code is below check..
Q: Read in 20 numbers, each of which is between 100 and 200. As each number is read, validate it and…
A: Here I have created 2 functions to check the number to be range and to check if the number is…
Q: 4. Declare a two-dimensional array that has 3 columns and 4 rows. 5. Write a for loop that will…
A: Ans 4: Declare the two dimensional array that has 3 columns and 4 rows is:\ int arr[4][3]…
Q: C# Question Assume that you have an array of integers called numbers that has been declared and…
A: Input : Array of integers with filled values. Output : Iterating over the whole array using for…
Q: 2. Rainfall Statistics Write a program that lets the user enter the total rainfall for each of 12…
A: Rainfall for 12 months can be taken from user using an array and loop. The calculate the total…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 2.3 Write a program that allows you to create an integer array of 18 elements with the following values: int A[] = {3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0}. Perform the following computations, a.Compute the sum of elements from index 0 to 14 and stores it at element 15 b.Compute the average of all numbers and stores it at element 16 c.Identifies the smallest value from the array and stores it at element 17 6.2 Create a Product class with Product Id & Product Name. Write a program to accept information of 10 products and store that in HashSet. Do following operations, a.Search a particular product in the HashSet.b.Remove a particular product from the HashSet by using product id.(Referbelow table for the product list) Product Id Product Name P001 Maruti 800 P002 Maruti Zen P003 Maruti Dezire P004 Maruti Alto 6.3 Implement LinkedListclass for this problema.Create an…//convert array of numbers from farenheit to celcius// example:// argument: [23, 32, 41, 50, 59]// return: [-5, 0, 5, 10, 15]// hint: use Array.mapfunction toCelcius(array){ } //write a function that takes an input array and returns an array of booleans (>=75) or fail (<75)// example:// argument: [20, 30, 50, 80, 90, 100]// return: [false, false, false, true, true, true]// hint: use Array.mapfunction passOrFail(array){ }1) Create a array of Fahrenheit temperatures, as follows int fahr []= {0,1,2,3,4,5,6,7,8,9,10,32,33,34,35,36,37,38,39,40}; 2) create a function convert(int fahr) that converts Fahr to Cels, such as you did in class, outside of main(), above it. 3) create a loop, that prints side by side Fahrenheit temperatures from the array above (in a similar way how you printed an array in class) and Celsius temperature by calling function convert(...) in the loop to get a matching Celsius temperature for each Fahrenheit temperature that you print. Do you program in C++ compiler online. Compile it step by step, making sure your code does not have syntax errors as you add new contents.
- Determine whether the following array declarations are valid. If a declaration is valid, determine the size of the array. a. int list[] = {18, 13, 14, 16};b. int x[10] = {1, 7, 5, 3, 2, 8};c. double y[4] = {2.0, 5.0, 8.0, 11.0, 14.0};d. double lengths[] = {8.2, 3.9, 6.4, 5.7, 7.3};e. int list[7] = {12, 13, , 14, 16, , 8};f. string name[8] = {"John", "Lisa", "Chris", "Katie"};fix the error in this code. #include<stdio.h> int insert(int *); int display(int *); int del(int *); void main() { int a[100]; int ch; while(1) { { printf("-------Menu-------"); printf("\nEnter 1 to insert element in array:\t"); printf("\nEnter 2 to display element in array:\t"); printf("\nEnter 3 to Delete element in array:\t"); printf("\nEnter 4 to Exit:\t"); printf("\n enter the choice \n"); scanf("%d",&ch); switch(ch) { case 1:insert(a); break; case 2:display(a); break; case 3:del(a); break; case 4:exit(0); } } } } int insert(int *a) { int i,n; printf("Enter the no. of elements in array:\t"); scanf("%d",&n); printf("\nEnter %d elements in array:\t",n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } a[i]='\0'; return *a; } int display(int *a) { int j;…Fill in the blank. What is the missing code for you to print all the elements inside the array?#include <iostream>using namespace std; int main(){int array[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; for(int i=0; i<3; i++) { for( _______; j<3; j++) { cout<<array[i][j]<<endl; } }} if you have an array int array[3][3] = {{1,2,3},{4,5,6},{7,8,9}};what will be the code for you to print number 9? DO NOT USE SPACE ON YOUR ANSWER
- Assume that an array of integers named a that contains exactly five elements has been declared and initialized. Write a single statement that assigns a new value to the first element of the array. This new value should be equal to twice the value stored in the last element of the array. Do not modify any values in the array other than the first element.Correct the following wrong statements. The following statement creates and initializes the 2-dimensional array values: short values[][] = {10, 20, 30, 40, 50};(Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current, and resistance. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to store in current are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to store in resistance are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Your program should pass these three arrays to a function named calc_volts(), which should calculate elements in the volts array as the product of the corresponding elements in the current and resistance arrays (for example ,volts[1]=current[1]resistance[1]). After calc_volts() has passed values to the volts array, the values in the array should be displayed from inside main().
- (Statistics) a. Write a C++ program that reads a list of double-precision grades from the keyboard into an array named grade. The grades are to be counted as they’re read, and entry is to be terminated when a negative value has been entered. After all grades have been input, your program should find and display the sum and average of the grades. The grades should then be listed with an asterisk (*) placed in front of each grade that’s below the average. b. Extend the program written for Exercise 1a to display each grade and its letter equivalent, using the following scale: Between90and100=AGreaterthanorequalto80andlessthan90=BGreaterthanorequalto70andlessthan80=CGreaterthanorequalto60andlessthan70=DLessthan60=F(Program) Write a declaration to store the following values in an array named rates: 12.9, 18.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer notation.(Electrical eng.) Write a program that specifies three one-dimensional arrays named current, resistance, and volts. Each array should be capable of holding 10 elements. Using a for loop, input values for the current and resistance arrays. The entries in the volts array should be the product of the corresponding values in the current and resistance arrays (sovolts[i]=current[i]resistance[i]). After all the data has been entered, display the following output, with the appropriate value under each column heading: CurrentResistance Volts