In need this in C language!
Write a program that declares a 40 element array of type double. Initialize the array so that:
the first 10 elements are equal to the square of the index variable
the next 10 each elements is equal to three times the index variable
the next 10 each element is equal to the sum of an element in the first 10 + an element in the second 10
the last 10 each element is equal to 10 * an element in previous 10
Output the array so that 10 elements per line are printed
The output should look like:
#include<stdio.h>
int main()
{
int arr[40];
int i;
for( i=0;i<10;i++)
{
arr[i]=i*i;
}
for( i=10;i<20;i++)
{
arr[i]=i*3;
}
for(i=20;i<30;i++)
{
arr[i]=arr[i-20]*arr[i-10];
}
for( i=30;i<40;i++)
{
arr[i]=arr[i-10]*10;
}
//printing element of array
for(i=0;i<40;i++)
{
if(i%10==0)
printf("\n");
printf("%6d\t",arr[i]);
}
}
In need this in C language! Write a program that declares a 40 element array of...
Submit two C++ files: 1. Write a C++ program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 components are equal to the square of the index variable, and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed. 2. Write a program that prompts the user to input a string and outputs the string in uppercase...
Write a C++ program: Declares an array named numberList with 50 components of the type int. Initialize the array so that the first 25 components are equal to the square of the counter (or index) variable and the last 25 components are equal to 1, 2, 3, … , 25. Output the array so that exactly ten elements per line are printed.
Write code that declares an array of integer values that will represent the first five even numbers: 2, 4, 6, 8, 10. Add code to initialize each element of the array with the even number values shown above. Add code to calculate the product of the array elements, and store the result in a variable named product. You must access the array elements to accomplish this. Do not write product = 2 * 4 * 6 * 8 * 10;...
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...
Write a java program that declares 10 element array (of type integers), creates and initializes the array, and perform the sum of elements of the array using for loop. public class SumArray { public static void main (String[], args) { } // end of main } // end of SumArray class
Part 2) write a C++ program that declares a 2 dimensional array: int CSIIAssign3 [10][12]; Initialize your array using a text file, user input or assign value while declaring the array, you can choose the method. Then, a. Write a loop to print first row of the array on one line, using cout. b. Write a loop to print first column of the array on one line, using cout. c. Write a loop to print first five rows of the...
in C language Write a program to find the element of an array, which occurs maximum number of times and its count. The program should accept the array elements as input from the user and print out the most occurring element along with its count. Hint: array size is 5. For example: Enter array elements (array size 5): 22321 Output: Max occurring element: 2. count: 3
Write a Program in C language for: 1. Create a C program to read 7 integers and store them in an array. Next, the program is to check if the array is symmetric, that is if the first element is equal to the last one, the value of the second one is equal to the value of the last but one, and so on. Since the middle element is not compared with another element, this would not affect the symmetry...
Pointer Comparisons Assignment Write a small program called PointerComparisions LastName.cpp that • Declares an array of floats Name your array floatArray o Implicitly initialize your array with 4 numbers • Demonstrates memory address of arrays increase as the subscript increases o Use a for loop to compare each of the adjacent elements from first to last o Watch out for the bounds! • Demonstrates memory address of arrays decrease as the subscript decreases o Use a for loop to compare...
| ome Insert Design Layout References Mailings View Help Tell me what you want to do from the l Unless you need to edit, it's safer to stay in 11. Write C++ statements that do the following: a. Declare an array alpha of 10 rows and 20 columns of type int. b. Initialize the array alpha to 0. c. Store 1 in the first row and 2 in the remaining rows d. Store 5 in the first column, and make...