Show square roots of 1 to 99 : double « Data Types « C++ Tutorial






#include <iostream> 
#include <cmath> 
using namespace std; 
 
int main() 
{ 
  int num; 
  double sq_root; 
 
  for(num=1; num < 100; num++) { 
    sq_root = sqrt((double) num); 
    cout << num << " " << sq_root << '\n'; 
  } 
 
  return 0; 
}
1 1
2 1.41421
3 1.73205
4 2
5 2.23607
6 2.44949
7 2.64575
8 2.82843
9 3
10 3.16228
11 3.31662
12 3.4641
13 3.60555
14 3.74166
15 3.87298
16 4
17 4.12311
18 4.24264
19 4.3589
20 4.47214
21 4.58258
22 4.69042
23 4.79583
24 4.89898
25 5
26 5.09902
27 5.19615
28 5.2915
29 5.38516
30 5.47723
31 5.56776
32 5.65685
33 5.74456
34 5.83095
35 5.91608
36 6
37 6.08276
38 6.16441
39 6.245
40 6.32456
41 6.40312
42 6.48074
43 6.55744
44 6.63325
45 6.7082
46 6.78233
47 6.85565
48 6.9282
49 7
50 7.07107
51 7.14143
52 7.2111
53 7.28011
54 7.34847
55 7.4162
56 7.48331
57 7.54983
58 7.61577
59 7.68115
60 7.74597
61 7.81025
62 7.87401
63 7.93725
64 8
65 8.06226
66 8.12404
67 8.18535
68 8.24621
69 8.30662
70 8.3666
71 8.42615
72 8.48528
73 8.544
74 8.60233
75 8.66025
76 8.7178
77 8.77496
78 8.83176
79 8.88819
80 8.94427
81 9
82 9.05539
83 9.11043
84 9.16515
85 9.21954
86 9.27362
87 9.32738
88 9.38083
89 9.43398
90 9.48683
91 9.53939
92 9.59166
93 9.64365
94 9.69536
95 9.74679
96 9.79796
97 9.84886
98 9.89949
99 9.94987








2.7.double
2.7.1.Convert feet to meters using doubles
2.7.2.Differences between int and double during 'divide'
2.7.3.Use the Pythagorean theorem to find find the length of the hypotenuse
2.7.4.Calculation by double variables
2.7.5.Compute the regular payments for a loan.
2.7.6.Show square roots of 1 to 99
2.7.7.how many rolls of wallpaper are required for a room with double type variables
2.7.8.Calculate the future value
2.7.9.Show decimal point field when displaying double and set filler
2.7.10.Do while loop: double value and fabs()
2.7.11.Compare double in if statement
2.7.12.Calcluate Exponents of a double value
2.7.13.Compare double base on precision
2.7.14.Use double value as the while loop counter
2.7.15.Check the value of a double read from keyboard