0

With the following code:

#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159;

int main() {

double x;
cin >> x; 

cout << "A=" << pi * x * x << endl; 

return 0; 
}

And inputting

100.64

I get the value 31819.3, while what I want is 31819.3103

I tried using set precision but that doesn't seem to work either. Why is this happening?

Aashir shukla
  • 93
  • 1
  • 9

0 Answers0