Write statements to accomplish each of the following: a) Display the value of th
ID: 3651167 • Letter: W
Question
Write statements to accomplish each of the following:a) Display the value of the seventh element of character array f.
b) Input a value into element 4 of single-subscripted floating-point array b.
c) Initialize each of the five elements of single-subscripted integer array g to 8.
d) Total the elements of floating-point array c of 100 elements.
e) Copy array a into the first portion of array b. Assume double a[11], b[34];
f) Determine and print the smallest and largest values contained in 99-element floatingpoint
array w.
Explanation / Answer
a) Display the value of the seventh element of character array f.
f[6];
b) Input a value into element 4 of single-subscripted floating-point array b.
b[3] = x;
c) Initialize each of the five elements of single-subscripted integer array g to 8.
for(int i=0; i <5; i++)
g[i] = 8;
d) Total the elements of floating-point array c of 100 elements.
float sum = 0;
for(int i=0; i <5; i++)
sum = sum + c[i];
e) Copy array a into the first portion of array b. Assume double a[11], b[34];
for(int i=0; i <11; i++)
b[i] = a[i]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.