Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let a = 13;
- let a_cubed = i32::pow(a,3);
- println!("a = {}, and cubed is {}", a, a_cubed);
- let b = 2.5;
- let b_cubed = f64::powi(b,3);
- let b_to_pi = f64::powf(b, std::f64::consts::PI);
- println!("{} cubed = {}, and {} to pi is {}", b, b_cubed, b, b_to_pi);
- //bitwise only for integers
- // | OR & AND ^ XOR ! NOR
- let c = 1|2;
- println!("1|2={}", c);
- //power of two using shitfwise
- let two_to_10 = 1<<10;
- println!("2^10 = {}", two_to_10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement