mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 21:29:18 +00:00
using costs::PI
using std lib for value of PI
This commit is contained in:
parent
c5898ac6b7
commit
d4a84a67b8
@ -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}!",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user