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

1. Write a program that prints 2, 4, 8, 16, 32… up to a number 2n where n is req

ID: 3620674 • Letter: 1

Question

1. Write a program that prints 2, 4, 8, 16, 32… up to a number 2n where n is requested from the user at the beginning of the program. Use any kind of “for”, “while”, or “do-while” loop that you like.

2. The following should be written as one program.
(a) Write a program that prints the value y of the equation
y=ax2n+bx2+cx+d

(b) The user should be asked to provide the integer value for n and the decimal values of a, b, c, d, and x.
(c) Using the same values of a, b, c, and x, have the same program then print the value y for
a= 2y2-x+3;
3. An integer is said to be prime if it is divisible only by 1 and itself.
(a) Write a function that determines if a number is prime.
(b) Use this function in a program that determines and prints all of the prime numbers between 1 and 1000.
4. Write a program that asks the user for the high temperature for each day in the month of January. Ask the user to enter all of the temperatures in either Celsius or Fahrenheit
(a) Store these temperatures in a one-dimensional array.
(b) Pass the array to a function that calculates and returns the average high temperature for the month.
(c) Pass the array to another function that finds and returns the highest temperature for the month.
(d) Print out the average high temperature and the maximum temperature. If the user entered the temperatures in Celsius, then follow the temperature with a C. If the user entered temperatures in Fahrenheit, then follow the temperature with an F. Print in a tabular format that looks roughly like
Max Temp Average High
90.5 F 73.9 F
5. Consider the following expressions:
V= E1*d1+E2*d2+vP, E2= 2*E1*E1+E1-2, P = E2/5;
Write a program that solves E1, E2 and P iteratively for a given value of V. The program should do the following:
a. Request for V, d1 and d2
b. Request for an initial guess for E1 or E2 or P.
c. Request for maximum number of trial and acceptable range.
d. If convergence within the range print calculated E1, E2, P, V along with % of error.
e. If number of attempts exceed the specified maximum number of trial, print message stating that.


This homework will be graded on three components. Your code must run. Your code must be commented (succinct is fine). Your code must be well-formatted and readable with self-descriptive variable names. Please email your submission.

Explanation / Answer

please rate - thanks CRAMSTER rule - 1 question per post, this was 5. 5*45<350 so I did them all #include <iostream>
using namespace std;
int main ()
{int i,n,k;
cout<<"enter a number: ";
cin>>n;
k=1;
for(i=1;i<=n;i++)
    {k*=2;
     cout<<k<<" ";
     }
cout<<endl;
system("pause");
return 0;
}
----------------------------------------------------- #include <iostream>
using namespace std;
int main ()
{int n;
double a,b,c,d,x,y;
cout<<"enter a value for n: ";
cin>>n;
cout<<"enter a value for a: ";
cin>>a;
cout<<"enter a value for b: ";
cin>>b;
cout<<"enter a value for c: ";
cin>>c;
cout<<"enter a value for d: ";
cin>>d;
cout<<"enter a value for x: ";
cin>>x;
y=a*(x*x)*n+b*(x*x)+c*x+d;      //wasn't sure of the formula
cout<<"y=a*(x*x)*n+b*(x*x)+c*x+d="<<y<<endl;
a=2*(y*y)-x+3;
cout<<"a=2*(y*y)-x+3="<<a<<endl;
system("pause");
return 0;
}

----------------------------------------------- -------------------------------------------------- ---------------------------------------------------- this is incorrect, more information is needed