This program will use an interval [a, b] where a=1 and b=10. Write a program that will compute the values of the equation: y = (x-4)*(x-4) + 3 for integer x on the interval [a, b] and write them to a...


This program will use an interval[a, b]wherea=1 andb=10. Write a program that will compute the values of the equation:


y = (x-4)*(x-4) + 3    for integerx on the interval[a, b]


and write them to a file named loop.cpp.




You should write the function using (a)for loop, and (b)while loop



(a) for loop<br>#include <iostream><br>#include<cmath><br>using namespace std;<br>int main ()<br>// define a,b,x, y<br>int<br>for (<br>{<br>y =<br>cout<<

Extracted text: (a) for loop #include #include using namespace std; int main () // define a,b,x, y int for ( { y = cout<"for x="<<>
(b) while loop<br>#include <iostream><br>#include<cmath><br>using namespace std;<br>int main ()<br>{<br>// define a,b, x, y<br>int<br>;// initialize x<br>while<br>y =<br>cout<<

Extracted text: (b) while loop #include #include using namespace std; int main () { // define a,b, x, y int ;// initialize x while y = cout<"for x="<<>

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here