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

The following program works but it needs to be modified toread an int rather tha

ID: 3618842 • Letter: T

Question

The following program works but it needs to be modified toread an int rather than a double. (Note that sqrt () isnot defined for an int so assign n to a double and take sqrt() ofthat).

#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
cout<< "Please enter a floating-point value :";
double n ;
cin >> n ;
cout << " n == "<< n
<<" n+1 == " << n+1
<< " three times n == " << 3 * n
<< " twice n == "<< n + n
<< " n squared == "<< n * n
<< " half of n == " << n/2
<<" square root of n ==" <<sqrt(n)
<<endl ; // another name for newline ("end of line")
return 0;
}

Explanation / Answer

//Hope this will help you, //You should typecast before you pass tosqrt. #include #include using namespace std; int main () { cout> n ; cout