Advertisement
rfq

soal 2

rfq
Feb 8th, 2023
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<iostream>
  2. #include<math.h>
  3.  
  4. using namespace std;
  5.  
  6. double F(int x) {
  7.     double result = x * (sqrt(x + 1) - sqrt(x));
  8.     return result;
  9. }
  10.  
  11. double F2(int x) {
  12.     double result = x / (sqrt(x + 1) + sqrt(x));
  13.     return result;
  14. }
  15.  
  16. int main()
  17. {
  18.     // cout << F(100) << endl;
  19.     // cout << F2(100);
  20.    
  21.     int x = 100;
  22.    
  23.     double f = F(x);
  24.     // double galat = x - f;
  25.    
  26.     double f2 = F2(x);
  27.     // double galat2 = x - f2;
  28.    
  29.     printf("%.20f\n%.20f", f, f2);
  30.    
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement