using costs::PI

using std lib for value of PI
This commit is contained in:
Suman Biswas 2023-01-09 23:29:51 +05:30 committed by GitHub
parent c5898ac6b7
commit d4a84a67b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,13 +8,12 @@
// I AM NOT DONE // I AM NOT DONE
use std::f32; use std::f32{self, consts::PI};
fn main() { fn main() {
let pi = 3.14f32;
let radius = 5.00f32; let radius = 5.00f32;
let area = pi * f32::powi(radius, 2); let area = PI * f32::powi(radius, 2);
println!( println!(
"The area of a circle with radius {:.2} is {:.5}!", "The area of a circle with radius {:.2} is {:.5}!",