Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Question:
Q1) Write a code that asks the user for a positive integer, computes the square root of that integer, and return the result to the user. The computational error needs to be smaller than 0.01.
1. Get a positive integer 'X' as the input.
2. Start from an initial guess, G.
3. Compute the error = (G^2 - X).
4. If error < 0.01, report the G as the result and stop. If not, go to 5.
5. Update G, G = (G + X/G)/2. Go to 3.
Code Block
//This program computes the square root of a given positive integer and is written by Vahid D on 13/1/13
#include using namespace std; int main() { double G = 10, err; // G is an initial guess and err is the error int X; // input, positive integer cout << "Enter a positive integer: \n"; //ask user to enter a number cin >> X; // get the input err = (G*G - X); // compute the error while ( err > 0.01) // continue updating G till the error is smaller than 0.01 { G = (G + X/G)/2; err = (G*G - X); } cout << "Square root of " << X << " is: " << G << endl; // report the result return 0; }
Decision Trees - Artificial intelligence: Suppose you just ever do four things at the weekend: go shopping, watch a film, play tennis or just stay inside. What you do depends
Write an academic report on a significant software security exploit you have studied. Your report should include details such as, for example: The nature of the software vuln
How does an enumstatement differ from a typedef statement? Typedef statement permits user to define an identifier that would show an exiting data type. The user-defined data
Explain about the network security. Network security implies the protection of networks and their services through unauthorized access, destruction or disclosure, modificati
Simple codes for robot using applet
Optimal Page Replacement Algorithm The optimal page replacement algorithm that as well known as OPT is an algorithm which works as follows: while a page needs to be swapped in,
Enumerate the History of computers Basic information about technological development trends in computer in past and its projections in future. If you want to know about compute
What is a Spool request? Spool requests are formed during dialog or background processing and placed in the spool database with information about the printer and print format.
Write a program which collects in data samples from a port at 1 ms interval. The upper 4 bits collected data same as mastered and stored in an array in successive locations. ; R
Is the Process before and after the swap are the same? Give reason. Process before swapping is residing in the primary memory in its original form. The regions (text, data and
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd