Question
Write a C program to do the following...in this EXACT order: a. Declare an integer array named alpha of 50 elements. b. Use a for
Write a C program to do the following...in this EXACT order:
a. Declare an integer array named alpha of 50 elements.
b. Use a for loopt to initialize each element of alpha to its index value (e.g. alpha[0] = 0, alpha[1]=1, etc.).
c. Output the value of the first element of the array alpha.
d. Output the value of the last element of alpha.
e. Set the value of the 25th element of the array alpha to 62 and output the 25th element.
f. Set the value of element 10 to three times the value of element 50 plus 10 and output element 10.
g. Use a for loop to output the elements of alpha so that there are only 10 elements per line.
h. Use a for loop to output the value of an element of alpha if its index is a multiple of 2 or 3
i. Use a for loop to increment the elements with even numbered indices's; then output all the elements in the array, 5 elements per line
The output should look like:
The first array element: alpha[tbd] = tbd The last array element: alpha[tbd] = tbd The 25th array element: alpha[tbd] = tbd The 10th array element: alpha[tbd] = tbd 0 1 2 3 4 5 6 7 8 157 10 11 12 13 14 15 16 17 18 19 20 21 22 23 62 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 alpha[0] = 0 alpha[2] = 2 alpha[3] = 3 alpha[4] = 4 alpha[6] = 6 alpha[8] = 8 alpha[9] = 157 alpha[10] = 10 alpha[12] = 12 alpha[14] = 14 alpha[15] = 15 alpha[16] = 16 alpha[18] = 18 alpha[20] = 20 alpha[21] = 21 alpha[22] = 22 alpha[24] = 62 alpha[26] = 26 alpha[27] = 27 alpha[28] = 28 alpha[30] = 30 alpha[32] = 32 alpha[33] = 33 alpha[34] = 34 alpha[36] = 36 alpha[38] = 38 alpha[39] = 39 alpha[40] = 40 alpha[42] = 42 alpha[44] = 44 alpha[45] = 45 alpha[46] = 46 alpha[48] = 48 1 1 3 3 5 5 7 7 9 157 11 11 13 13 15 15 17 17 19 19 21 21 23 23 63 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started