Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. int main()
  6. {
  7.     std::cout << "Square roots:" << std::endl;
  8.     std::cout << std::setprecision(5); // Assumes that all values has only one digit before comma
  9.     for (int i = 1; i < 101; ++i) {
  10.         std::cout << std::setw(6) << sqrt(i) << std::endl;
  11.     }
  12.     std::cout << std::endl << "Cube roots:" << std::endl;
  13.     std::cout << std::setprecision(2);
  14.     for (int i = 1; i < 101; ++i) {
  15.         std::cout << cbrt(i) << std::endl;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement