Programming assingment
Closed
ayigbe
Posts
1
Registration date
Tuesday November 20, 2012
Status
Member
Last seen
November 20, 2012
-
Nov 20, 2012 at 05:24 AM
Zohaib R Posts 2368 Registration date Sunday September 23, 2012 Status Member Last seen December 13, 2018 - Nov 20, 2012 at 08:06 AM
Zohaib R Posts 2368 Registration date Sunday September 23, 2012 Status Member Last seen December 13, 2018 - Nov 20, 2012 at 08:06 AM
Related:
- Programming assingment
- R programming language download - Download - Programming languages
- Utorrent programming language - Guide
- Sim card programming software free download - Download - Backup and recovery
- Python programming language download - Download - Programming languages
- Scratch programming download - Download - Programming languages
1 response
Zohaib R
Posts
2368
Registration date
Sunday September 23, 2012
Status
Member
Last seen
December 13, 2018
69
Nov 20, 2012 at 08:06 AM
Nov 20, 2012 at 08:06 AM
Hi ayigbe,
You can check the below mentioned code to write the program to calculate square root of a number in C++.
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
double number; //user input
double answer; //answer to square root
cout << "Please enter a number: ";
cin >> number; //get the user input
cout << endl << endl;
answer = sqrt(number);
cout << "The square root of " << number;
cout << " is " << setprecision(4) << answer << endl;
return(0);
}
Do reply with results.
You can check the below mentioned code to write the program to calculate square root of a number in C++.
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
double number; //user input
double answer; //answer to square root
cout << "Please enter a number: ";
cin >> number; //get the user input
cout << endl << endl;
answer = sqrt(number);
cout << "The square root of " << number;
cout << " is " << setprecision(4) << answer << endl;
return(0);
}
Do reply with results.