📜  取两个整数,返回商和余数,divmod - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.240000             🧑  作者: Mango

代码示例1
//  Take two integers, return the quotient and remainder
fn divmod(dividend: isize, divisor: isize) -> (isize, isize) {
    (dividend / divisor, dividend % divisor)
}

fn main() {
    let (q, r) = divmod(14, 3);
    println!("divmod = quotient {}, remainder {} ", q, r);
}