Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Cheqq 3t.dy Guise: Solubc Moving to another question will save this response Que

ID: 3594332 • Letter: C

Question

Cheqq 3t.dy Guise: Solubc Moving to another question will save this response Question 42 of 43 Question 42 50 points Save Answer In this problem, you will need to step through a large array to find how many value fit a given condition. This is similar to a homework problem. You are free to reuse any code you have written yourself. This problem is longer than the others, so you may want to come back to it. Problem statement Give the following array of float values, how many of the values, when squared, result in a value greater than .5? For example, the value of 0.80 when squared would be 0.64, which would count toward the total. Here is the list of values in a single array initializer float r[500]={ 0.99,-0.10,-0.86,0.38 , 0.73,1.00,0.66,0.53,0.64,-0.65,0.03,0.83,0.48,-0.32,0.28,0.75,0.33,-0.80,-0 . 48,0.47,-0.76,0.10,0.04,- 0.89,0.19,0.11,-0.33,0.16,0.33,-0.08,0.17,0.68,-0.83, 0.66,0.06,0.90,0.66,0.07,0.43,0.29,0.42,-0.19,0.12,0.25,0.85,0.85,-0.00,0.18,-0.95,0.87,- 0.35,-0.35,-0,04,-0.96,0.11r-0.84,0.15,-0.87,0.67,-0.17,0.04,0.19,-0.49,0.56,-0.15, 0. 92,0.46,-0.50,-0.02,0.24,0.79,-0.60,-0.96,0.27,0.65,- 0.76,0.47,0.00,0.42,0.52,-0.13,-0.58-0.48,-0.82,-0.54,0.97,-0.66,0.96,-0.90,-0.64,-0.20,0.49,0.55,0.30,0.06,-0.60,0.22,-0.14,0.25,-0.44,- 0.90,0.40,-0.04,-0.,51,-0.33,-0.04,-0.26,-0.86,-0.69,-0.49,-0.99,0.53,-0.07,-0,13,0.71,0.74,-0.15,-0.59,0.70,0.30,-0.23,-0.50,-0.21,-0.33,-0.85,- 0.80,0.42,0.73,0.06r-0.33,-0.71,0.51.-0.94,0.60,-0.99,-0.27,-0.09,0.10,0.22,0.23,0.60,0.22,0.11,-0.46,-0.91, -0.17,-0.72,0.29,0,59,0.98,-0.06,- 0.30,-0.17,0.73,0.37,0.34,-0.71,-0.21,0.07,0.70,0.81,0.35,0.21,0.87,0.31,0.57,-0.05,-0.78,-0.34,-0.83,0.80,-0.73,0.74,-0.08,0.16,-0.81,- 0.90,0.43,0.48,-0.96,0.77,-0.58,-0.26,-0.05,-0.49,-0.53,-0.71,0,15,0.61,0.70,-0.15,0.41,041,-0.59,0.28 ,-0.28,-0.67,-0.41,-0.06,-0.01,- 0.24,0.10,0.61,-0.50,-0.63,-0.23,-0.30,-0.18,-0.44,-0.47,-0.14,-0.32,0.31,0.96,0.98,-0.83,-0.22,-0.38,0.32,-0.61,-0.68,-0.48,-0.85,0.73,0.28,0.79 0.55,0.61,-0.62,0.74,-0.05,0.14,0.20-0.08,0.99,0.56,-0.96,0.04,-0.61,-0.05,0.57,0.60,0.98,0.23,0.56,0.96,0.40,-0.31,-0.42,-0.28,0.08- 0.10,0.58,0.58-0.02,-0.14,0.37,0.43,-0.18,0.75,0.53,0.77,0.24,-0.27,0.04,0.23,-0.36,0.09,-0.73, 0,03,-0.96,-0,81.-0.02,-0.98,0,42,-0.10, 0.67,0.17,0.59,0.26,-0.76,0.01,-0.49,0.83,-0.41,0.49,0.04,0.96,0.28,0.86,0.71,-0.19,0.98,0.30,0.54,0.03,-0.47,-0.82,-0.53,0.16,0.56,-0.49,0.70,- 0.45,-0.12,0.48,0.80,0.56,-0.34,0.38r-0.17,-0.10-0.60,0.34,-0.27,-0.01,-0.17,0.77,0.31,-0.89,0.98,0.38,0.28,0.96,-0.32,0.17,-0,01,0.56,0.70,0.46,- 0.28,0.26,-0.68,-0.22,-0.84,0.55-0.74,0.95,0.12,-0,09,0.69,-0.71,0.82,-0.91,0.63,-0.10,0.44,-0.18,0.01,0.10,-0.07,-0.01,-0.53,-0.79- 0.04,0.50,0.37,-0.70,0.06,0.07,-0.88.-0.86,-0.32,-0.56,-0.09,0.19,-0.66,0.17,0.15,0.81,-0.56,0.19,-0.90,-0.40,0.28,0.73,0.50,0.07,-0.45,-0.49,- 0,48,0,83,0.51-0.01,-0.61,-0.19,-0.15,0.76,0.12,-0.74,0.19,0.23,-0.25,0,87,-0.98,0.66,0.41,-0.64,0.18,-0.44-0.83,0.97,0.75,-0,37,-0.42,0.38,- 0.63,-0.93,-0.20,0.27,-0.06,0.32,0.10,-0.20,-0.34,0.50,0.61,0.51,0.61,0.08,0.77,-0.20,-0.34,-0.48,0.02,-0.32,-0.46,-0.57,0.40,-0.93,0.34,0.92,- 0.61,0.44,-0.45,-0,03,0.18,0.27,0.39 0.98,-0.46,-0.67,0.65,1.00,0.48,-0.69,0.49,0.44,0.82,0.46,-0.48,0.95,-0.39,0.18,-0.18,0.98r-0.79,0.71,- 0.24,0.61,-0.87.-0,89,0.89,-0.47,0.90,-0.56,0.49,0.08,0.71,0.24,0.41,-0.74,0,57,0.06,-0.39,0.06,0,37,-0.55,-0.15, 0,54,0.91,0.37,0.84-0.12,- 0.09,0.01,-0.14, 0.12,0.08,0.62,0.08,0.21,-0.92,-0.03,-0.91,0.98,0.77,0.94,0.41,0.481; 10-17/2017

Explanation / Answer

#include <stdio.h>

int main()
{
float r[500]={ 0.99,-0.10,-0.86,0.38,0.73,1.00,0.66,0.53,0.64,-0.65,0.03,0.83,0.48,-0.32,-0.28,0.75,0.33,-0.80,-0.48,0.47,-0.76,0.10,0.04,-0.89,0.19,0.11,-0.33,0.16,0.33,-0.08,0.17,0.68,-0.83, 0.66,0.06,0.90,0.66,0.07,0.43,0.29,0.42,-0.19,0.12,0.25,0.85,0.85,-0.00,0.18,-0.95,0.87,-0.35,-0.35,-0.04,-0.96,0.11,-0.84,0.15,-0.87,0.67,-0.17,0.04,0.19,-0.49,0.56,-0.15,0.92,0.46,-0.50,-0.02,0.24,0.79,-0.60,-0.96,0.27,0.65,-0.76,0.47,0.00,0.42,0.52,-0.13,-0.58,-0.48,-0.82,-0.54,0.97,-0.66,0.96,-0.90,-0.64,-0.20,0.49,0.55,0.30,0.06,-0.60,0.22,-0.14,0.25,-0.44,-0.90,0.40,-0.04,-0.51,-0.33,-0.04,-0.26,-0.86,-0.69,-0.49,-0.99,0.53,-0.07,-0.13,0.71,0.74,-0.15,-0.59,0.70,0.30,-0.23,-0.50,-0.21,-0.33,-0.85,-0.80,0.42,0.73,0.06,-0.33,-0.71,0.51,-0.94,0.60,-0.99,-0.27,-0.09,0.10,0.22,0.23,0.60,0.22,0.11,-0.46,-0.91,-0.17,-0.72,0.29,0.59,0.98,-0.06,-0.30,-0.17,0.73,0.37,0.34,-0.71,-0.21,0.07,0.70,0.81,0.35,0.21,0.87,0.31,0.57,-0.05,-0.78,-0.34,-0.83,0.80,-0.73,0.74,-0.08,0.16,-0.81,-0.90,0.43,0.48,-0.96,0.77,-0.58,-0.26,-0.05,-0.49,-0.53,-0.71,0.15,0.61,0.70,-0.15,0.41,0.41,-0.59,0.28,-0.28,-0.67,-0.41,-0.06,-0.01,-0.24,0.10,0.61,-0.50,-0.63,-0.23,-0.30,-0.18,-0.44,-0.47,-0.14,-0.32,0.31,0.96,0.98,-0.83,-0.22,-0.38,0.32,-0.61,-0.68,-0.48,-0.85,0.73,0.28,0.79,-0.55,0.61,-0.62,0.74,-0.05,0.14,0.20,-0.08,0.99,0.56,-0.96,0.04,-0.61,-0.05,0.57,0.60,0.98,0.23,0.56,0.96,0.40,-0.31,-0.42,-0.28,0.08,-0.10,0.58,0.58,-0.02,-0.14,0.37,0.43,-0.18,0.75,0.53,0.77,0.24,-0.27,0.04,0.23,-0.36,0.09,-0.73,0.03,-0.96,-0.81,-0.02,-0.98,0.42,-0.10,-0.67,0.17,0.59,0.26,-0.76,0.01,-0.49,0.83,-0.41,0.49,0.04,0.96,0.28,0.86,0.71,-0.19,0.98,0.30,0.54,0.03,-0.47,-0.82,-0.53,0.16,0.56,-0.49,0.70,-0.45,-0.12,0.48,0.80,0.56,-0.34,0.38,-0.17,-0.10,-0.60,0.34,-0.27,-0.01,-0.17,0.77,0.31,-0.89,0.98,0.38,0.28,0.96,-0.32,0.17,-0.01,0.56,0.70,0.46,-0.28,0.26,-0.68,-0.22,-0.84,0.55,-0.74,0.95,0.12,-0.09,0.69,-0.71,0.82,-0.91,0.63,-0.10,0.44,-0.18,0.01,0.10,-0.07,-0.01,-0.53,-0.79,-0.04,0.50,0.37,-0.70,0.06,0.07,-0.88,-0.86,-0.32,-0.56,-0.09,0.19,-0.66,0.17,0.15,0.81,-0.56,0.19,-0.90,-0.40,0.28,0.73,0.50,0.07,-0.45,-0.49,-0.48,0.83,0.51,-0.01,-0.61,-0.19,-0.15,0.76,0.12,-0.74,0.19,0.23,-0.25,0.87,-0.98,0.66,0.41,-0.64,0.18,-0.44,-0.83,0.97,0.75,-0.37,-0.42,0.38,-0.63,-0.93,-0.20,0.27,-0.06,0.32,0.10,-0.20,-0.34,0.50,0.61,0.51,0.61,0.08,0.77,-0.20,-0.34,-0.48,0.02,-0.32,-0.46,-0.57,0.40,-0.93,0.34,0.92,-0.61,0.44,-0.45,-0.03,0.18,0.27,0.39,0.98,-0.46,-0.67,0.65,1.00,0.48,-0.69,0.49,0.44,0.82,0.46,-0.48,0.95,-0.39,0.18,-0.18,0.98,-0.79,0.71,-0.24,0.61,-0.87,-0.89,0.89,-0.47,0.90,-0.56,0.49,0.08,0.71,0.24,0.41,-0.74,0.57,0.06,-0.39,0.06,0.37,-0.55,-0.15,0.54,0.91,0.37,0.84,-0.12,-0.09,0.01,-0.14,0.12,0.08,0.62,0.08,0.21,-0.92,-0.03,-0.91,0.98,0.77,0.94,0.41,0.48};
int total = 0,i;
float square;
for(i=0;i<500; i++) {
square = r[i] * r[i];
if(square > 0.5) {
total++;
}
}
printf("Number of values which squared greater than 0.5 is : %d ", total);
return 0;
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote