using loops create an array of 10 elements. Fill the array with values in increments of 3. Create a second array that takes the square root of the elements in the first array. The output should show both arrays contents
In visual studio program for C++
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int first[10];
double second[10];
// using loops create an array of 10 elements
for (int i = 0; i < 10; ++i) {
// Fill the array with values in increments of 3
first[i] = 3*i;
}
// Create a second array that takes the square root of the elements in the first array
for (int i = 0; i < 10; ++i) {
second[i] = sqrt(first[i]);
}
// The output should show both arrays contents
for (int i = 0; i < 10; ++i) {
cout << first[i] << "\t" << second[i] << endl;
}
return 0;
}

using loops create an array of 10 elements. Fill the array with values in increments of...
Write a C++ program to : Create array arr1 of size 10 Assign values to elements such that - say index = i, arr1[i] = 10 - i. Print arr1 Create arr2 and copy alternate elements from arr1 starting from index 1. Print arr2. Sort arr1 in ascending array and print its elements from indices 3 to 8 Print every output on a different line and separate array elements by spaces.
Write a c program that finds the uncommon elements from two array elements using pointers only . For example : Enter the length of the array one : 5 Enter the elements of the array one: 9 8 5 6 3 Enter the length of the array two: 4 Enter the elements of the array two: 6 9 2 1 output: 8 5 3 2 1 void uncommon_ele(int *a, int n1, int *b, int n2, int *c, int*size); The function...
C++ QUESTION Loops, arrays, functions find the three largest values in an array of integers and output them to the screen. You must utilize at least three functions, counting main as a function, AND you must use parameters/arguments in one of them. Set up an integer array of 10 elements, read in the ten elements from the keyboard. There are many ways to solve this lab. Here are a couple of ideas: Use a function to find the largest value...
***************C PROGRAMMING ONLY************* Demonstrate the ability to create an array on the stack Demonstrate the ability to create an array on the heap allowing user to choose the number of values to store. Demonstrate the ability to store an array of Struct values on both the stack and the heap. Program Specifications: 1. Create a struct with at least 3 fields - any struct you want but explain it in your comments in the code. Populate at least 10 elements...
Create a C# program using WINDOWS FORM App in Visual Studio. THE ANSWER MUST BE IN C#, IN WINDOW FORM APP, IN VISUAL STUDIOS. Write the code to: Write a method called MaximumDiffrence that accepts an integer array as a parameter and return the maximum difference between adjacent values in the array, where the gap is defined as the absolute value of the difference between the 2 adjacent values. Example: if the array contains {5, 7, 4, 9, 6, 12,...
C++
This week, you are to create two separate programs, first using a simple array and the second using a 2D-array (matrix). [Part 1] Write a program that accepts exactly ten (10) integer numbers from the user and stores them in an array. In a separate for-loop, the program then goes through the elements in the array to print back: (i) The sum of the 10 numbers, (ii) the minimum value from the 10 numbers, and (iii) the maximum value...
Create a program that creates an array of 500 random numbers between -10 and 10. Write several functions: Function 1 - prints the array with a certain number of elements per line. Prototype: void printArray(int array[], int numElements, int numPerLine, ostream &os) Function 2 prints only the array elements that are evenly divisible by an input number. Prototype: void printDivBy(int array[], int numElements, int numPerLine, int divBy, ostream &os) Function 3 takes the input array and returns the maximum, the...
C++. Write a program that copies the contents of one array into another array but in reverse order using pointers. - in main() - define 2 arrays of type int, 10 elements each - initialize one array with numbers 1 through 10 - initialize all elements of the second array to 0 - call function reverseCopy with both arrays as arguments - display the values of array number 2 (reversed order) - reverseCopy...
I should use the array and loop to create a java program
according to the instruction, but I have no idea how to do
it.
Introduction This lab assignment continues to give you practice using loops, particularly loops with variable termination conditions, and it also provides you an opportunity to use one-dimensional arrays. Recall that an array is used to store a collection of data. The data can be values of Java primitive data types or else objects (for instance,...
using C language
Create an array of doubles with 5 elements. In the array prompt the user to enter 5 temperature values (in degree Fahrenheit). Do this within main. Create a user defined function called convert2Cels. This function will not return any values to main with a return statement. It should have parameters that include the temperature array and the number of elements. The function should convert the values for Fahrenheit to Celsius and save them back into the same...