Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. fn main() {
  2. let a = 13;
  3. let a_cubed = i32::pow(a,3);
  4. println!("a = {}, and cubed is {}", a, a_cubed);
  5.  
  6. let b = 2.5;
  7. let b_cubed = f64::powi(b,3);
  8. let b_to_pi = f64::powf(b, std::f64::consts::PI);
  9. println!("{} cubed = {}, and {} to pi is {}", b, b_cubed, b, b_to_pi);
  10.  
  11. //bitwise only for integers
  12. // | OR & AND ^ XOR ! NOR
  13. let c = 1|2;
  14. println!("1|2={}", c);
  15.  
  16. //power of two using shitfwise
  17. let two_to_10 = 1<<10;
  18. println!("2^10 = {}", two_to_10);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement