Programming assingment
Closed
ayigbe
Posts
1
Registration date
Tuesday 20 November 2012
Status
Member
Last seen
20 November 2012
-
20 Nov 2012 à 05:24
Zohaib R Posts 2368 Registration date Sunday 23 September 2012 Status Member Last seen 13 December 2018 - 20 Nov 2012 à 08:06
Zohaib R Posts 2368 Registration date Sunday 23 September 2012 Status Member Last seen 13 December 2018 - 20 Nov 2012 à 08:06
Related:
- Programming assingment
- R programming download - Download - Programming languages
- Scratch programming language download - Download - Programming languages
- Eclipse programming download - Download - IDE
- Delphi programming software - Download - IDE
- Programming polymorphism - Guide
1 response
Zohaib R
Posts
2368
Registration date
Sunday 23 September 2012
Status
Member
Last seen
13 December 2018
69
20 Nov 2012 à 08:06
20 Nov 2012 à 08:06
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.