daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::iter::Product;
  2. use std::ops::RangeInclusive;
  3.  
  4.  
  5. fn factorial_iterative<T, Out>(m: T, n: T) -> Out
  6. where
  7.     T: Product, RangeInclusive<T>: Iterator<Item = T>,
  8.     Out: Product<T>
  9. {
  10.     let ret = (m..=n).product();
  11.     return ret;
  12. }
  13.  
  14. fn main()
  15. {
  16.     let x:i32 = factorial_iterative::<i32, _>(1, 5);
  17.     dbg!(x);
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top