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; }
Use of Hypertext links in Internet access From the user's point of view, the Web having of a vast, worldwide collection of documents i.e. pages. Every page may have links (poin
An 8-bit successive approximation ADC has a resolution of 20mV. What will be its digital output for an analog input of 2.17V? Ans: Given data Resolution =20mv Analog input =2.
Explanation Constants are "variables" that cannot be changed within a function- or script-body. The value will always be the similar during script-implementation. Syntax "AX
How to use ActiveX Control in .Net ? ActiveX control is a special type of COM component that handles a User Interface. Using ActiveX Control in your .Net Project is even simple
PCI bus transactions: PCI bus traffic is prepared of a series of PCI bus transactions. Each transaction is build up of an address phase that is followed by 1 or more data phas
Q. Convention used to represent micro-operations? The convention used to represent micro-operations is: 1. Computer register names are designated by capital letters (someti
Automatic typewriter : It is a power-driven machine, which automatically types a standard pro forma from a previously punched or stencilled master. When the master is placed on th
Compact Disc; Compact Disc ( CD) is an optical disc which is used to store digital data. It was initially developed to store sound recordings completely, but later it als
If a programmer doesn't wish to make modifies to the document he can lock the document data and its code from more changes by changing the extension of the file system to .MDE. Cha
Give detail explanation about Arithmetic Micro-operations These micro-operations perform some essential arithmetic operations on numeric data stored in the registers. These bas
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