hey I\'m having trouble this is my program and i need the output to be a double
ID: 3651771 • Letter: H
Question
hey I'm having trouble this is my program and i need the output to be a double to show 2 decimal places, could someone please show me how to fix this program to do it.#include <iostream>
using namespace std;
int main ()
{
int guess,n,r,i = 1;
cout << "What number do you want to find the square root of?" << endl;
cin >> n;
guess = n/2;
cout << guess <<endl;
while (i <= 5)
{
r = n/ guess;
guess = (guess + r)/2;
double answer = (guess) / 1;
cout << answer << endl;
i = ++i;
answer = 1.00;
}
return 0;
Explanation / Answer
n is an integer in following program - #include #include using namespace std; int main () { int n,i = 1; double guess,r; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.