csansoon

P4.01 P38045 Computing square roots and squares

Oct 24th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.     cout.setf(ios::fixed);
  7.     cout.precision(6);
  8.     int n;
  9.     double s;
  10.     while (cin >> n) {
  11.         s=pow(n,0.5);
  12.         n=n*n;
  13.         cout << n << " " << s << endl;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment